Skip to content

Commit

Permalink
CI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhmud Ahmad committed Jan 10, 2024
1 parent 4c3c920 commit 1a919cf
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 31 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
branches: [main]
name: Create Release PR
jobs:
prepare-release:
if: "!contains(github.event.head_commit.message, 'chore: Release')" # Skip merges from releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config --global user.name GitHub Actions
git config user.email [email protected]
- uses: knope-dev/[email protected]
with:
version: 0.13.0
- run: knope prepare-release --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
37 changes: 7 additions & 30 deletions .github/workflows/actions.yaml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
name: Release
on: workflow_dispatch
on:
pull_request:
types: [closed]
branches: [main]
jobs:
prepare-release:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.commit.outputs.sha }}
steps:
- uses: actions/checkout@v4
name: Fetch entire history (for conventional commits)
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config --global user.name GitHub Actions
git config user.email [email protected]
- name: Install Knope
uses: knope-dev/[email protected]
with:
version: 0.11.0
- run: knope prepare-release --verbose
name: Update versioned files and changelog
- name: Store commit
id: commit
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

build-artifacts:
needs: prepare-release
if: github.head_ref == 'release' && github.event.pull_request.merged == true
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -60,20 +39,18 @@ jobs:
if-no-files-found: error

release:
needs: [build-artifacts, prepare-release]
needs: [build-artifacts]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-release.outputs.sha }}
- uses: actions/[email protected]
with:
path: release
merge-multiple: true
- name: Install Knope
uses: knope-dev/[email protected]
with:
version: 0.11.0
version: 0.13.0
- run: knope release --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 17 additions & 1 deletion knope.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,32 @@ name = "dotlottie-player.wasm.tar.gz"
[[workflows]]
name = "prepare-release"

[[workflows.steps]]
type = "Command"
command = "git switch -c release"

[[workflows.steps]]
type = "PrepareRelease"

[[workflows.steps]]
type = "Command"
command = "git commit -m \"chore: prepare release $version\" && git push"
command = "git commit -m \"chore: Release $version\" && git push --force --set-upstream origin release"

[workflows.steps.variables]
"$version" = "Version"

[[workflows.steps]]
type = "CreatePullRequest"
base = "main"

[workflows.steps.title]
template = "chore: Release $version"
variables = { "$version" = "Version" }

[workflows.steps.body]
template = "This PR was created by Knope. Merging it will create a new release\n\n$changelog"
variables = { "$changelog" = "ChangelogEntry" }

[[workflows]]
name = "release"

Expand Down

0 comments on commit 1a919cf

Please sign in to comment.