Skip to content

Commit

Permalink
GitHub release CI
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 15, 2024
1 parent 09843ca commit 0ec316c
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: GitHub Release

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:

push:
branches:
- "*"
tags:
- "*"

workflow_dispatch:

env:
name: row

defaults:
run:
shell: bash

jobs:
release:
name: Build release tarball
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
with:
submodules: true
path: code

- name: Determine filename-safe ref from GITHUB_REF_NAME
run: echo ref="$(echo "${GITHUB_REF_NAME}" | sed -e 's/\//-/g')" >> "$GITHUB_ENV"
working-directory: code

- name: Write version change log
run: grep -m 2 -B 10000 "^## v*\d*\.\d*\.\d*" doc/src/release-notes.md | sed '$d' | tee "${GITHUB_WORKSPACE}/changelog.md"
working-directory: code

- name: Copy source
run: cp -R code "${name}-${ref}"

- name: Remove .git
run: rm -rf "${name}-${ref}/.git" && ls -laR "${name}-${ref}"

- name: Tar/xz source
run: tar -cvJf "${name}-${ref}.tar.xz" "${name}-${ref}"

- uses: actions/[email protected]
with:
name: source
path: |
*.tar.*
changelog.md
publish:
name: Publish [GitHub]
needs: [release]
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/[email protected]
with:
merge-multiple: true

- name: Create release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
*.xz
body_path: changelog.md
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions doc/src/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
## 0.1.0 (not yet released)

* Initial release.

## 0.0.0

0 comments on commit 0ec316c

Please sign in to comment.