-
Notifications
You must be signed in to change notification settings - Fork 3
99 lines (87 loc) · 2.86 KB
/
release.yml
File metadata and controls
99 lines (87 loc) · 2.86 KB
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
96
97
98
name: publish
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
on-main-branch-check:
runs-on: ubuntu-latest
outputs:
on_main: ${{ steps.contains_tag.outputs.retval }}
steps:
# TODO: remove this and the `git branch -a` when the following PR
# is merged and released:
# https://github.com/rickstaa/action-contains-tag/pull/18
- name: git config --global remote.origin.followRemoteHEAD never
run: git config --global remote.origin.followRemoteHEAD never
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: rickstaa/action-contains-tag@v1
id: contains_tag
with:
reference: "main"
tag: "${{ github.ref_name }}"
test-docs:
name: test-docs
needs: on-main-branch-check
if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }}
uses: "./.github/workflows/test-docs.yml"
# FIXME: environment not being picked up in test-register action
# test-register:
# name: test-register
# needs: on-main-branch-check
# if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }}
# uses: "./.github/workflows/test-register.yml"
make-changelog:
runs-on: ubuntu-latest
needs:
- test-docs
# FIXME: add this back in when test-register is working
# - test-register
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout the Repository at the Tagged Commit
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
- name: Generate a Changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
args: --latest --verbose
env:
GITHUB_REPO: ${{ github.repository }}
make-github-release:
runs-on: ubuntu-latest
environment: github
permissions:
contents: write
pull-requests: read
needs: make-changelog
steps:
- name: Checkout the Repository at the Tagged Commit
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body: ${{ needs.make-changelog.outputs.release_body }}
draft: false
prerelease: false
- name: Update the latest tag
shell: bash
run: |
latest_tag=$(echo "${{ github.ref_name }}" | cut -c -2)
git config --global user.name "Github Actions"
git config --global user.email "nobody@fulcrumgenomics.com"
git tag -d "${latest_tag}" || echo ""
git tag -a -m "Release version ${{ github.ref_name }}" "${latest_tag}"
git push origin ":refs/tags/${latest_tag}" || echo ""
git push origin "${latest_tag}"