From 276e2f58578bc463bdc9980ec2fd1c8ab84f0670 Mon Sep 17 00:00:00 2001 From: Heliozoa Date: Mon, 9 Sep 2024 14:32:58 +0300 Subject: [PATCH 1/2] Trigger deploy on release creation --- .github/workflows/linux.yml | 11 +++++++++-- .github/workflows/macos.yml | 11 +++++++++-- .github/workflows/windows.yml | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index f1280eb..a9b6c44 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,6 +1,13 @@ name: Linux -on: push +on: + push: + branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] + pull_request: + branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] + release: + types: + - created env: CARGO_TERM_COLOR: always @@ -32,7 +39,7 @@ jobs: deploy: needs: test - if: startsWith(github.ref, 'refs/tags/v') + if: ${{ github.event_name == 'release' }} runs-on: ubuntu-20.04 strategy: matrix: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 9e5cd09..12340fe 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,6 +1,13 @@ name: macOS -on: push +on: + push: + branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] + pull_request: + branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] + release: + types: + - created env: CARGO_TERM_COLOR: always @@ -30,7 +37,7 @@ jobs: deploy: needs: test - if: startsWith(github.ref, 'refs/tags/v') + if: ${{ github.event_name == 'release' }} runs-on: macos-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5d2997e..ba9f66e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,6 +1,13 @@ name: Windows -on: push +on: + push: + branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] + pull_request: + branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] + release: + types: + - created env: CARGO_TERM_COLOR: always @@ -33,7 +40,7 @@ jobs: deploy: needs: test - if: startsWith(github.ref, 'refs/tags/v') + if: ${{ github.event_name == 'release' }} runs-on: windows-latest strategy: matrix: From 952258720dd325797ef88598e3c718f1fbf1fcdb Mon Sep 17 00:00:00 2001 From: Heliozoa Date: Mon, 9 Sep 2024 14:36:32 +0300 Subject: [PATCH 2/2] Fix use of deprecated items in CI --- .github/workflows/linux.yml | 3 ++- .github/workflows/macos.yml | 5 +++-- .github/workflows/windows.yml | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a9b6c44..bccae0d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -70,7 +70,8 @@ jobs: - name: Get the version id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Deploy run: gsutil cp target/${{ matrix.target }}/release/tmc gs://${{ secrets.GCP_BUCKET }}/tmc-cli-rust/tmc-cli-rust-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 12340fe..c25881b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -45,7 +45,7 @@ jobs: - uses: google-github-actions/setup-gcloud@v2 with: project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} + credentials_json: ${{ secrets.GCP_SA_KEY }} - name: Cargo build run: cargo build -p tmc --release --verbose @@ -55,7 +55,8 @@ jobs: - name: Get the version id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Deploy run: gsutil cp target/release/tmc gs://${{ secrets.GCP_BUCKET }}/tmc-cli-rust/tmc-cli-rust-x86_64-apple-darwin-${{ steps.get_version.outputs.VERSION }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ba9f66e..8418533 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -51,7 +51,7 @@ jobs: - uses: google-github-actions/setup-gcloud@v2 with: project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} + credentials_json: ${{ secrets.GCP_SA_KEY }} - name: Enable long paths for git run: git config --system core.longpaths true # allow long paths from git deps @@ -65,7 +65,7 @@ jobs: - name: Get the version id: get_version shell: bash - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Create msi installer run: |