2022-07-10 22:48:32 +02:00
|
|
|
on:
|
|
|
|
push:
|
2022-07-10 23:10:07 +02:00
|
|
|
branches:
|
|
|
|
- 'main'
|
2022-07-10 22:48:32 +02:00
|
|
|
jobs:
|
2022-07-10 23:10:07 +02:00
|
|
|
tag:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
outputs:
|
2022-07-10 23:16:36 +02:00
|
|
|
should_publish: ${{ steps.create-and-push-tag.outputs.should_publish }}
|
2022-07-10 23:10:07 +02:00
|
|
|
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"
|
2022-07-10 23:26:33 +02:00
|
|
|
SHOULD_PUBLISH='true'
|
|
|
|
git push origin "v${{ steps.determine-version.outputs.version }}" || SHOULD_PUBLISH='false'
|
2022-07-10 23:12:32 +02:00
|
|
|
echo "::set-output name=should_publish::$SHOULD_PUBLISH"
|
2022-07-10 23:10:07 +02:00
|
|
|
|
2022-07-10 23:14:12 +02:00
|
|
|
- name: Result
|
2022-07-10 23:18:33 +02:00
|
|
|
run: |
|
|
|
|
echo "The result is: ${{ steps.create-and-push-tag.outputs.should_publish }}"
|
2022-07-10 23:14:12 +02:00
|
|
|
|
2022-07-10 22:48:32 +02:00
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-22.04
|
2022-07-10 23:10:07 +02:00
|
|
|
needs: tag
|
2022-07-10 23:30:23 +02:00
|
|
|
# if: ${{ needs.tag.outputs.should_publish == 'true' }}
|
2022-07-10 22:48:32 +02:00
|
|
|
steps:
|
2022-07-10 23:33:35 +02:00
|
|
|
- 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 }}
|
2022-07-10 23:30:23 +02:00
|
|
|
# - 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
|
2022-07-10 22:48:32 +02:00
|
|
|
|
2022-07-10 23:30:23 +02:00
|
|
|
# - name: Publish qbittorrent-web-api
|
|
|
|
# uses: actions-rs/cargo@v1
|
|
|
|
# with:
|
|
|
|
# command: publish
|