Skip to content

Commit

Permalink
feat: update releases when release branches change (#26)
Browse files Browse the repository at this point in the history
This change enables automatic PDF generation for releases when release
branches are changed. This supports "backporting" changes to prior
releases.

This works by:
  - Creating a branch named 'release/XYZ', where XYZ is the name of a
    release, when a release is made.
  - Activating PDF generation when 'release/XYZ' branches are changed.
  - Updating the release XYZ when PDF generation is finished.

The release may be named anything. The only portion of the name that is
important for these actions is 'release/' in the branch name.
  • Loading branch information
Nostracodus committed Nov 16, 2021
1 parent c2d9f47 commit 9e51128
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/produce-branch-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Creates or updates a release's generated PDF when a change occurs
# to a release branch
name: Update Existing Release
on:
push:
branches:
- "release/*"

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "RELEASE_NAME=$(echo ${GITHUB_REF#refs/heads/release/})" >> $GITHUB_ENV
- name: Compile document
uses: xu-cheng/latex-action@v2
with:
root_file: ifc.tex
working_directory: ltx
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{env.RELEASE_NAME}}
prerelease: false
title: ${{env.RELEASE_NAME}}
files: ltx/ifc.pdf
18 changes: 10 additions & 8 deletions .github/workflows/produce-prerelease.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

# Creates or updates a 'prerelease' release whenever main is
# changed. Attaches a built PDF to that release.
name: Create prerelease PDF
on:
push:
Expand All @@ -17,11 +18,12 @@ jobs:
root_file: ifc.tex
working_directory: ltx

- name: Create Release
uses: ncipollo/release-action@v1.8.10
- name: Create prerelease
uses: "marvinpinto/action-automatic-releases@latest"
with:
allowUpdates: true
name: prerelease
tag: prerelease
artifacts: ltx/ifc.pdf
removeArtifacts: true
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "prerelease"
prerelease: true
title: "Prerelease"
files: |
ltx/ifc.pdf
17 changes: 17 additions & 0 deletions .github/workflows/produce-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Creates a release branch whenever a release is created.

name: Create Release Branch
on:
release:
types:
- published

jobs:
create_branch:
runs-on: ubuntu-latest
steps:
- uses: peterjgrainger/action-create-branch@v2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'release/${{ github.event.release.tag_name }}'
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Build PDF document
# Builds a PDF of the IFC spec and attaches it to any release that
# is created.

name: Attach PDF to Release
on:
release:
types:
- created
- published

jobs:
build_latex:
Expand Down

0 comments on commit 9e51128

Please sign in to comment.