Automated scheduled releases with changelogs [WIP] #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v26 | |
- name: build | |
run: nix-build -A ci | |
version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# This fetches the entire Git history. | |
# This is needed so we can determine the commits (and therefore PRs) | |
# where the changelogs have been added | |
depth: 0 | |
- uses: cachix/install-nix-action@v26 | |
- name: Increment version and assemble changelog | |
run: | | |
nix-build -A autoVersion | |
version=$(result/bin/auto-version . ${{ github.event.pull_request.number || '' }}) | |
git commit --all --message "Version $version | |
Automated release" | |
echo "version=$version" >> "$GITHUB_ENV" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Outputting draft release notes | |
if: ${{ env.version && github.event_name != 'push' }} | |
run: cat changes/released/${{ env.version }}.md > "$GITHUB_STEP_SUMMARY" | |
- name: Update release branch | |
if: ${{ env.version && github.event_name == 'push' }} | |
run: git push origin HEAD:release | |
test-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v26 | |
- name: test update script | |
run: | | |
nix-build -A autoPrUpdate | |
{ | |
result/bin/auto-pr-update . | |
echo "" | |
echo '```diff' | |
git diff | |
echo '```' | |
} > $GITHUB_STEP_SUMMARY | |
env: | |
GH_TOKEN: ${{ github.token }} |