-
Notifications
You must be signed in to change notification settings - Fork 14
95 lines (76 loc) · 2.49 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Edit `release.yml` in `.github/workflows/templates` and run `make_workflows.py` to update the
# workflow.
name: GitHub Release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
# Trigger on pull requests.
pull_request:
# Trigger on pushes to the mainline branches. This prevents building commits twice when the pull
# request source branch is in the same repository.
push:
branches:
- "master"
- "maint"
# Trigger on tags. Tag builds create GitHub releases with the change log and source tarball.
tags:
- "v*"
# Trigger on request.
workflow_dispatch:
env:
name: hoomd
jobs:
release:
name: Build release tarball
runs-on: ubuntu-latest
container:
image: glotzerlab/ci:2021.07-ubuntu20.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
submodules: true
path: code
- name: Determine last tag via git describe
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
run: echo "tag=$(git describe --abbrev=0)" >> $GITHUB_ENV
working-directory: code
# git describe does not return the current tag in tag pushes on GitHub Actions, use GITHUB_REF instead
- name: Determine tag from GITHUB_REF
if: startsWith(github.ref, 'refs/tags/v')
run: echo "tag=$(echo ${GITHUB_REF} | sed -e 's/refs\/tags\///g')" >> $GITHUB_ENV
- name: Write version change log
run: .github/workflows/make-changelog-md.sh ${tag} | tee ${GITHUB_WORKSPACE}/changelog.md
working-directory: code
- name: Copy source
run: cp -R code ${name}-${tag}
- name: Remove .git
run: rm -rf ${name}-${tag}/.git && ls -laR ${name}-${tag}
- name: Tar source
run: tar -cvzf ${name}-${tag}.tar.gz ${name}-${tag}
- name: Upload release files
uses: actions/upload-artifact@v2.2.4
with:
name: release
path: |
*.tar.gz
changelog.md
publish:
name: Publish [GitHub]
needs: [release]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2.0.10
with:
name: release
- name: Create release
uses: softprops/action-gh-release@v0.1.12
if: startsWith(github.ref, 'refs/tags/v')
with:
files: "*.tar.gz"
body_path: changelog.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}