qbittorrent_web_api/.github/workflows/publish.yml

81 lines
2.1 KiB
YAML
Raw Permalink Normal View History

2022-07-11 00:31:05 +02:00
name: Publish
2022-07-11 16:14:17 +02:00
2022-07-10 22:48:32 +02:00
on:
push:
2022-07-10 23:10:07 +02:00
branches:
2022-07-11 16:14:17 +02:00
- main
env:
CARGO_TERM_COLOR: always
2022-07-10 22:48:32 +02:00
jobs:
2022-07-10 23:10:07 +02:00
tag:
2022-07-11 17:07:40 +02:00
runs-on: ubuntu-22.04
2022-07-11 16:14:17 +02:00
2022-07-10 23:10:07 +02:00
outputs:
2022-07-10 23:16:36 +02:00
should_publish: ${{ steps.create-and-push-tag.outputs.should_publish }}
2022-07-11 16:14:17 +02:00
2022-07-10 23:10:07 +02:00
steps:
2022-07-11 00:52:09 +02:00
- uses: actions/checkout@v3
2022-07-10 23:10:07 +02:00
- 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:
2022-07-11 17:07:40 +02:00
runs-on: ubuntu-22.04
2022-07-11 16:14:17 +02:00
2022-07-10 23:10:07 +02:00
needs: tag
2022-07-10 23:36:00 +02:00
if: ${{ needs.tag.outputs.should_publish == 'true' }}
2022-07-11 16:14:17 +02:00
2022-07-10 22:48:32 +02:00
steps:
2022-07-11 00:52:09 +02:00
- uses: actions/checkout@v3
2022-07-10 22:48:32 +02:00
2022-07-10 23:38:00 +02:00
- name: Verify version
run: ./.github/verify_version.sh
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
2022-07-11 00:44:24 +02:00
profile: minimal
2022-07-11 02:07:48 +02:00
override: true
2022-07-10 23:38:00 +02:00
- 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-11 00:45:11 +02:00
- name: Sleep for 30 seconds - wait for qbittorrent-web-api-gen to be available
2022-07-11 00:27:53 +02:00
uses: jakejarvis/wait-action@master
with:
2022-07-11 00:45:11 +02:00
time: '30s'
2022-07-11 00:27:53 +02:00
2022-07-10 23:38:00 +02:00
- name: Publish qbittorrent-web-api
uses: actions-rs/cargo@v1
with:
command: publish