From 5734f1f309eeb0fdef55547db523d90e3456323b Mon Sep 17 00:00:00 2001 From: dark0dave Date: Sun, 17 Mar 2024 16:40:54 +0000 Subject: [PATCH] fix(ci): Update ci Signed-off-by: dark0dave --- .github/workflows/main.yaml | 27 +++++++++++---------------- .github/workflows/nightly.yaml | 23 ++++------------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c160c01..5027ab4 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -10,14 +10,14 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v4 with: set-safe-directory: true - uses: actions/setup-python@v2 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable - - uses: pre-commit/action@v2.0.0 + - uses: pre-commit/action@v3.0.1 build: runs-on: ${{ matrix.os }} strategy: @@ -33,14 +33,13 @@ jobs: target: x86_64-pc-windows-msvc suffix: .exe steps: - - uses: actions/checkout@v3.0.2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable - - uses: actions-rs/cargo@v1 - with: - command: build - args: --release + - name: build + run: | + cargo build --release - name: Archive release artifacts uses: actions/upload-artifact@v1 with: @@ -55,7 +54,7 @@ jobs: tag_name: ${{ steps.get_tag.outputs.git_tag }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Generate a changelog @@ -63,20 +62,17 @@ jobs: id: git-cliff with: config: cliff.toml - args: --verbose --latest -u + args: --verbose --latest env: OUTPUT: CHANGELOG.md - name: Print the changelog run: cat "${{ steps.git-cliff.outputs.changelog }}" - - name: Get the tag - id: get_tag - run: echo ::set-output name=git_tag::${GITHUB_REF/refs\/tags\//} - name: Create Release id: create_release uses: ncipollo/release-action@v1.13.0 with: bodyFile: ./CHANGELOG.md - prerelease: ${{ startsWith(steps.get_tag.outputs.git_tag, 'nightly') }} + prerelease: ${{ contains(github.ref, 'nightly') }} upload: needs: [release] runs-on: ubuntu-latest @@ -106,4 +102,3 @@ jobs: asset_path: ./post_infinity${{ matrix.suffix }} asset_name: post_infinity-${{ matrix.target }}${{ matrix.suffix }} asset_content_type: application/octet-stream - diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index d5eca11..1928ed1 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -8,23 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v4 with: fetch-depth: 0 set-safe-directory: true - - name: Set tag name - id: git_tag - run: echo "::set-output name=tag::$(git describe --tags --match '[0-9].[0-9].[0-9]')" - - name: check if tag exists - id: tag_exists - run: | - set -x - exists=false - [ "$(git tag -l "${TAG}")" = "${TAG}" ] && exists=true - [ "$(git tag -l "nightly-${TAG}")" = "nightly-${TAG}" ] && exists=true - echo "::set-output name=result::${exists}" - env: - TAG: ${{ steps.git_tag.outputs.tag }} - name: Setup SSH Keys and known_hosts env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock @@ -33,13 +20,11 @@ jobs: ssh-keyscan github.com >> ~/.ssh/known_hosts ssh-agent -a $SSH_AUTH_SOCK > /dev/null ssh-add - <<< "${{ secrets.GH_SSH_KEY }}" - if: ${{ steps.tag_exists.outputs.result != 'true' }} - name: Create tag env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock - TAG: "nightly-${{ steps.git_tag.outputs.tag }}" run: | - git tag "${TAG}" + tag=$(git describe --tags --match 'v[0-9].[0-9].[0-9]') + git tag "nightly-${tag}" git remote set-url origin git@github.com:dark0dave/post_infinity.git - git push origin "refs/tags/${TAG}" - if: ${{ steps.tag_exists.outputs.result != 'true' }} + git push origin "refs/tags/nightly-${tag}" || true