From 91580cca287c8679f50a329df45c04b235951d03 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Sun, 10 Jul 2022 20:48:32 +0000 Subject: [PATCH] Manually push tag --- .devcontainer/devcontainer.json | 3 ++- .github/workflows/publish.yml | 34 +++++++++++++++++++++++ .github/workflows/release.yml | 48 ++++++++++++++++++++------------- .github/workflows/tag.yml | 10 +++---- 4 files changed, 71 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b2a00db..1c4a773 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,7 +25,8 @@ "rust-lang.rust-analyzer", "tamasfe.even-better-toml", "serayuzgur.crates", - "redhat.vscode-yaml" + "redhat.vscode-yaml", + "eamodio.gitlens" ] } }, diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d21231e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' +jobs: + publish: + runs-on: ubuntu-22.04 + steps: + - 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d21231e..42796ee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,34 +1,46 @@ on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + create: + branches: + - 'create_release/*' jobs: - publish: + release: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - - name: Verify version - run: ./.github/verify_version.sh - - name: Install latest stable uses: actions-rs/toolchain@v1 with: toolchain: stable + override: true - - name: Login - uses: actions-rs/cargo@v1 + - name: Install cargo-edit + uses: baptiste0928/cargo-install@v1 with: - command: login - args: ${{ secrets.CRATES_IO_TOKEN }} + crate: cargo-edit - - name: Publish qbittorrent-web-api-gen - uses: actions-rs/cargo@v1 + - name: Determine version + id: vars + uses: actions/github-script@v5 with: - command: publish - args: --package qbittorrent-web-api-gen + script: | + const { GITHUB_REF } = process.env + const version = GITHUB_REF.replace('refs/heads/create_release/', '') + console.log(`Got the following version: ${version}`) + return version + result-encoding: string + + - name: Bump version + run: cargo set-version --workspace ${{ steps.vars.outputs.result }} - - name: Publish qbittorrent-web-api - uses: actions-rs/cargo@v1 + - name: Commit files + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -am "Prepare version" + + - name: Push changes + uses: ad-m/github-push-action@master with: - command: publish + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} \ No newline at end of file diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 8815a77..7bd2161 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -14,8 +14,8 @@ jobs: VERSION=$(cat Cargo.toml | grep version | head -1 | sed 's/version = //' | sed 's/"//g') echo "::set-output name=version::$VERSION" - - uses: Klemensas/action-autotag@stable - with: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - version: "${{ steps.determine-version.outputs.version }}" - tag_prefix: "v" \ No newline at end of file + - name: 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 push origin "v${{ steps.determine-version.outputs.version }}"