ci: Modified CI/CD workflows so they can be tested locally with Act

This commit is contained in:
2025-08-29 10:58:39 -06:00
parent 0b29351366
commit 63ae64cebd
5 changed files with 37 additions and 11 deletions
+3
View File
@@ -0,0 +1,3 @@
--artifact-server-path=./.act/artifacts
--cache-server-path=./.act/cache
--env ACT=true
+4 -4
View File
@@ -76,15 +76,15 @@ jobs:
RUSTDOCFLAGS: --cfg docsrs RUSTDOCFLAGS: --cfg docsrs
msrv: msrv:
# check that we can build using the minimal rust version that is specified by this crate # check that we can build using the minimal rust version that is specified by this crate
name: 1.85.0 / check name: 1.89.0 / check
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install 1.85.0 - name: Install 1.89.0
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@master
with: with:
toolchain: 1.85.0 toolchain: 1.89.0
- name: cargo +1.85.0 check - name: cargo +1.89.0 check
run: cargo check run: cargo check
+28 -7
View File
@@ -23,6 +23,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Configure SSH for Git - name: Configure SSH for Git
if: env.ACT != 'true'
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.RELEASE_BOT_SSH_KEY }}" > ~/.ssh/id_ed25519 echo "${{ secrets.RELEASE_BOT_SSH_KEY }}" > ~/.ssh/id_ed25519
@@ -30,11 +31,18 @@ jobs:
ssh-keyscan -H github.com >> ~/.ssh/known_hosts ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- name: Checkout repository - name: Checkout repository
if: env.ACT != 'true'
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ssh-key: ${{ secrets.RELEASE_BOT_SSH_KEY }} ssh-key: ${{ secrets.RELEASE_BOT_SSH_KEY }}
fetch-depth: 0 fetch-depth: 0
- name: Checkout repository
if: env.ACT == 'true'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@@ -62,12 +70,6 @@ jobs:
- name: Install Rust stable - name: Install Rust stable
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
- name: Update the Cargo.lock
run: |
cargo update
git add Cargo.lock
git commit -m "chore: Bump the version in Cargo.lock"
- name: Get the new version tag - name: Get the new version tag
id: version id: version
run: | run: |
@@ -84,6 +86,13 @@ jobs:
echo "Previous tag: $PREV_TAG" echo "Previous tag: $PREV_TAG"
echo "prev_version=$PREV_TAG" >> $GITHUB_ENV echo "prev_version=$PREV_TAG" >> $GITHUB_ENV
- name: Bump Cargo.toml version
run: |
sed -i "s/^version = \".*\"/version = \"${{ env.version }}\"/" Cargo.toml
cargo update
git add Cargo.toml
git commit -m "chore: Bump the version in Cargo.toml"
- name: Generate changelog for the version bump - name: Generate changelog for the version bump
id: changelog id: changelog
run: | run: |
@@ -92,6 +101,7 @@ jobs:
echo "changelog_body=$(cat artifacts/changelog.md)" >> $GITHUB_ENV echo "changelog_body=$(cat artifacts/changelog.md)" >> $GITHUB_ENV
- name: Push changes - name: Push changes
if: env.ACT != 'true'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
@@ -129,7 +139,7 @@ jobs:
steps: steps:
- name: Check if actor is repository owner - name: Check if actor is repository owner
if: ${{ github.actor != github.repository_owner }} if: ${{ github.actor != github.repository_owner && env.ACT != 'true' }}
run: | run: |
echo "You are not authorized to run this workflow." echo "You are not authorized to run this workflow."
exit 1 exit 1
@@ -269,7 +279,13 @@ jobs:
changelog_body="$(cat ./artifacts/changelog.md)" changelog_body="$(cat ./artifacts/changelog.md)"
echo "changelog_body=$(cat artifacts/changelog.md)" >> $GITHUB_ENV echo "changelog_body=$(cat artifacts/changelog.md)" >> $GITHUB_ENV
- name: Validate release environment variables
run: |
echo "Release version: ${{ env.RELEASE_VERSION }}"
echo "Changelog body: ${{ env.changelog_body }}"
- name: Create a GitHub Release - name: Create a GitHub Release
if: env.ACT != 'true'
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -344,6 +360,7 @@ jobs:
echo "Release version: ${{ env.RELEASE_VERSION }}" echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Package and Publish package to Chocolatey - name: Package and Publish package to Chocolatey
if: env.ACT != 'true'
run: | run: |
mkdir ./deployment/chocolatey/tools mkdir ./deployment/chocolatey/tools
# Run packaging script # Run packaging script
@@ -395,11 +412,13 @@ jobs:
echo "Release version: ${{ env.RELEASE_VERSION }}" echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Execute Homebrew packaging script - name: Execute Homebrew packaging script
if: env.ACT != 'true'
run: | run: |
# run packaging script # run packaging script
python "./deployment/homebrew/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/homebrew/managarr.rb.template" "./managarr.rb" ${{ env.MACOS_SHA }} ${{ env.MACOS_SHA_ARM }} ${{ env.LINUX_SHA }} python "./deployment/homebrew/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/homebrew/managarr.rb.template" "./managarr.rb" ${{ env.MACOS_SHA }} ${{ env.MACOS_SHA_ARM }} ${{ env.LINUX_SHA }}
- name: Push changes to Homebrew tap - name: Push changes to Homebrew tap
if: env.ACT != 'true'
env: env:
TOKEN: ${{ secrets.MANAGARR_GITHUB_TOKEN }} TOKEN: ${{ secrets.MANAGARR_GITHUB_TOKEN }}
run: | run: |
@@ -457,6 +476,7 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub - name: Push to Docker Hub
if: env.ACT != 'true'
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
@@ -501,5 +521,6 @@ jobs:
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
- uses: katyo/publish-crates@v2 - uses: katyo/publish-crates@v2
if: env.ACT != 'true'
with: with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
+1
View File
@@ -175,6 +175,7 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Upload to codecov.io - name: Upload to codecov.io
if: env.ACT != 'true'
uses: codecov/codecov-action@v4 uses: codecov/codecov-action@v4
with: with:
fail_ci_if_error: true fail_ci_if_error: true
+1
View File
@@ -1,3 +1,4 @@
/target /target
/.idea/ /.idea/
/.scannerwork/ /.scannerwork/
/.act/