diff --git a/.github/workflows/_push_swagger.yml b/.github/workflows/_push_swagger.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/smart-contract-verifier.yml b/.github/workflows/smart-contract-verifier.yml index 4f6b4bd60..a39d6e757 100644 --- a/.github/workflows/smart-contract-verifier.yml +++ b/.github/workflows/smart-contract-verifier.yml @@ -23,48 +23,48 @@ defaults: working-directory: smart-contract-verifier jobs: - test: - name: Unit, doc and integration tests - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - with: - working-directory: smart-contract-verifier - - - name: Unit tests - run: RUST_BACKTRACE=1 RUST_LOG=info cargo test --locked --workspace --all-features --lib --bins -- --nocapture - if: success() || failure() - - - name: Doc tests - run: RUST_BACKTRACE=1 RUST_LOG=info cargo test --locked --workspace --all-features --doc -- --skip proto - if: success() || failure() - - - name: Integration tests - run: RUST_BACKTRACE=1 RUST_LOG=info cargo test --locked --workspace --test '*' -- --nocapture - if: success() || failure() - - lint: - name: Linting - uses: ./.github/workflows/_linting.yml - with: - working-directory: smart-contract-verifier - - docker: - name: Docker build and docker push - needs: - - test - - lint - if: | - always() && - (needs.test.result == 'success' || needs.test.result == 'cancelled') && - (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - uses: ./.github/workflows/_docker-build-push.yml - with: - service-name: smart-contract-verifier +# test: +# name: Unit, doc and integration tests +# runs-on: ubuntu-latest +# steps: +# - name: Checkout sources +# uses: actions/checkout@v4 +# +# - name: Setup +# uses: ./.github/actions/setup +# with: +# working-directory: smart-contract-verifier +# +# - name: Unit tests +# run: RUST_BACKTRACE=1 RUST_LOG=info cargo test --locked --workspace --all-features --lib --bins -- --nocapture +# if: success() || failure() +# +# - name: Doc tests +# run: RUST_BACKTRACE=1 RUST_LOG=info cargo test --locked --workspace --all-features --doc -- --skip proto +# if: success() || failure() +# +# - name: Integration tests +# run: RUST_BACKTRACE=1 RUST_LOG=info cargo test --locked --workspace --test '*' -- --nocapture +# if: success() || failure() +# +# lint: +# name: Linting +# uses: ./.github/workflows/_linting.yml +# with: +# working-directory: smart-contract-verifier +# +# docker: +# name: Docker build and docker push +# needs: +# - test +# - lint +# if: | +# always() && +# (needs.test.result == 'success' || needs.test.result == 'cancelled') && +# (needs.lint.result == 'success' || needs.lint.result == 'cancelled') +# uses: ./.github/workflows/_docker-build-push.yml +# with: +# service-name: smart-contract-verifier copy-swagger: name: Copy swagger @@ -73,14 +73,33 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Pushes + - name: Get the current tag, branch, or commit hash + id: git_info + run: | + # Extract the tag if it matches the pattern refs/tags/smart-contract-verifier/v1.2.3 + if [[ "${GITHUB_REF}" =~ refs/tags/smart-contract-verifier/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then + version=$(echo "${GITHUB_REF}" | grep -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+') + echo "version=${version}" >> $GITHUB_ENV + + # If it's the main branch + elif [ "${GITHUB_REF#refs/heads/}" = "main" ]; then + echo "version=main" >> $GITHUB_ENV + + # Otherwise, use the first 8 characters of the commit hash + else + echo "version=${GITHUB_SHA:0:8}" >> $GITHUB_ENV + fi + + - name: Push swagger to another repo uses: dmnemec/copy_file_to_another_repo_action@main env: - API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} + API_TOKEN_GITHUB: ${{ secrets.BLOCKSCOUT_BOT_TOKEN }} with: source_file: 'smart-contract-verifier/smart-contract-verifier-proto/swagger/v2/smart-contract-verifier.swagger.yaml' + rename: 'swagger.yaml' + commit_message: '[BOT] [CREATE-SWAGGER] [SKIP-GH-PAGES] create swagger for "smart-contract-verifier" of version ${{ env.version }}' destination_repo: 'blockscout/swaggers' - destination_folder: 'services/smart-contract-verifier' - user_email: 'rimrakhimov@gmail.com ' - user_name: 'rimrakhimov' - destination_branch: 'master' \ No newline at end of file + destination_folder: "services/smart-contract-verifier/${{ env.version }}" + user_email: 'bot@blockscout.com' + user_name: 'blockscout-bot' + destination_branch: 'master'