Skip to content

Commit

Permalink
chore(ci): bump github actions dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Chawye Hsu <[email protected]>
  • Loading branch information
chawyehsu committed Oct 10, 2024
1 parent 66bbe3b commit 9aa6be3
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ permissions:
pull-requests: write
jobs:
# format and lint check
style_check:
ci_style_check:
name: Code Style Check
runs-on: windows-latest
env:
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
steps:
- name: Checkout Source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Rust Setup
uses: dtolnay/rust-toolchain@stable
Expand All @@ -27,7 +27,7 @@ jobs:
components: clippy, rustfmt

- name: Cache Setup
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].6

- name: Format Check
run: cargo fmt -- --check
Expand All @@ -36,9 +36,9 @@ jobs:
run: cargo clippy

# tests and build
test_build:
ci_test_build:
name: Test Build
needs: style_check
needs: ci_style_check
strategy:
fail-fast: false
matrix:
Expand All @@ -52,7 +52,7 @@ jobs:
RUSTC_WRAPPER: sccache
steps:
- name: Checkout Source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Rust Setup
uses: dtolnay/rust-toolchain@stable
Expand All @@ -61,18 +61,18 @@ jobs:
target: ${{ matrix.target }}

- name: Cache Setup
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].6

- name: Tests Check
run: cargo test --workspace

- name: Build Check
- name: Dev Build
run: cargo build --locked --target ${{ matrix.target }}

# Create/Update release PR
release_please:
cd_release_please:
name: Release Please
needs: test_build
needs: ci_test_build
runs-on: ubuntu-latest
if: github.repository == 'chawyehsu/hok' && github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
Expand All @@ -86,11 +86,11 @@ jobs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}

# Build artifacts
github_build:
# Build production artifacts
cd_release_build:
name: Release Build
needs: release_please
if: ${{ needs.release_please.outputs.release_created == 'true' }}
needs: cd_release_please
if: ${{ needs.cd_release_please.outputs.release_created == 'true' }}
strategy:
fail-fast: false
matrix:
Expand All @@ -114,7 +114,7 @@ jobs:
RUSTC_WRAPPER: sccache
steps:
- name: Checkout Source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Rust Setup
uses: dtolnay/rust-toolchain@stable
Expand All @@ -123,14 +123,10 @@ jobs:
target: ${{ matrix.target }}

- name: Cache Setup
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].6

- name: Build
uses: actions-rs/[email protected]
with:
command: build
args: --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.os == 'ubuntu-latest' }}
- name: Production Build
run: cargo build --release --locked --target ${{ matrix.target }}

- name: Strip artifacts [Linux]
if: matrix.os == 'ubuntu-latest'
Expand Down Expand Up @@ -161,30 +157,30 @@ jobs:
cd -
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}

# Create GitHub release with Rust build targets and release notes
upload_artifacts:
name: Create Release
needs: [release_please, github_build]
cd_attach_artifacts:
name: Release Artifacts
needs: [cd_release_please, cd_release_build]
runs-on: ubuntu-latest
steps:
- name: Prepare Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: Prepare Checksums
run: for file in hok-*/hok-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done

- name: Publish Release
run: gh release edit ${{ needs.release_please.outputs.tag_name }} --draft=false --repo=chawyehsu/hok
run: gh release edit ${{ needs.cd_release_please.outputs.tag_name }} --draft=false --repo=chawyehsu/hok
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Attach Artifacts
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: hok-*/hok-*
tag_name: ${{ needs.release_please.outputs.tag_name }}
tag_name: ${{ needs.cd_release_please.outputs.tag_name }}

0 comments on commit 9aa6be3

Please sign in to comment.