on: push: branches: - 'main' jobs: tag: runs-on: ubuntu-22.04 outputs: should_publish: ${{ steps.create-and-push-tag.outputs.should_publish }} steps: - uses: actions/checkout@v2 - name: Determine version id: determine-version run: | VERSION=$(cat Cargo.toml | grep version | head -1 | sed 's/version = //' | sed 's/"//g') echo "::set-output name=version::$VERSION" - name: Create and push tag id: create-and-push-tag run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git tag "v${{ steps.determine-version.outputs.version }}" -a -m "Create new release" SHOULD_PUBLISH='true' git push origin "v${{ steps.determine-version.outputs.version }}" || SHOULD_PUBLISH='false' echo "::set-output name=should_publish::$SHOULD_PUBLISH" - name: Result run: | echo "The result is: ${{ steps.create-and-push-tag.outputs.should_publish }}" publish: runs-on: ubuntu-22.04 needs: tag if: ${{ needs.tag.outputs.should_publish == 'true' }} steps: - run: echo needs.tag.outputs.should_publish ${{ needs.tag.outputs.should_publish }} - run: echo needs.tag.outputs.should_publish == 'true' ${{ needs.tag.outputs.should_publish == 'true' }} - run: echo needs.tag.outputs.should_publish == 'false' ${{ needs.tag.outputs.should_publish == 'false' }} - run: echo needs.tag.outputs.should_publish == true ${{ needs.tag.outputs.should_publish == true }} - run: echo needs.tag.outputs.should_publish == false ${{ needs.tag.outputs.should_publish == false }} # - uses: actions/checkout@v2 # - name: Verify version # run: ./.github/verify_version.sh # - name: Install latest stable # uses: actions-rs/toolchain@v1 # with: # toolchain: stable # - name: Login # uses: actions-rs/cargo@v1 # with: # command: login # args: ${{ secrets.CRATES_IO_TOKEN }} # - name: Publish qbittorrent-web-api-gen # uses: actions-rs/cargo@v1 # with: # command: publish # args: --package qbittorrent-web-api-gen # - name: Publish qbittorrent-web-api # uses: actions-rs/cargo@v1 # with: # command: publish