diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index f1280eb..bccae0d 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: @@ -63,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 9e5cd09..c25881b 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 @@ -38,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 @@ -48,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 5d2997e..8418533 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: @@ -44,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 @@ -58,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: |