Skip to content

Commit

Permalink
fix(ci): Update ci
Browse files Browse the repository at this point in the history
Signed-off-by: dark0dave <dark0dave@mykolab.com>
  • Loading branch information
dark0dave committed Mar 17, 2024
1 parent 6a52f69 commit 5734f1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 35 deletions.
27 changes: 11 additions & 16 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -55,28 +54,25 @@ 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
uses: orhun/git-cliff-action@v3
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
Expand Down Expand Up @@ -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

23 changes: 4 additions & 19 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 5734f1f

Please sign in to comment.