generated from plus3it/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (50 loc) · 1.73 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
name: Create GitHub Release
on:
# Run on demand
workflow_dispatch:
# Run on push to main when .bumpversion.cfg version is updated
push:
branches:
- main
paths:
- .bumpversion.cfg
jobs:
lint:
uses: ./.github/workflows/lint.yml
test:
uses: ./.github/workflows/test.yml
release:
needs:
- lint
# The test workflow currently is expected to fail, since neither localstack
# nor moto support the required AWS SSO endpoints
# - test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- run: git fetch --tags --force origin
# WA: https://github.com/actions/checkout/issues/882
- name: Test release condition
id: release
run: |
set -eu -o pipefail
RELEASE=false
PRIOR_VERSION=$(git describe --abbrev=0 --tags || true)
RELEASE_VERSION=$(grep current_version .bumpversion.cfg | sed 's/^.*= //' )
if [[ "$PRIOR_VERSION" != "$RELEASE_VERSION" ]]; then RELEASE=true; fi
echo "condition=${RELEASE}"
echo "version=${RELEASE_VERSION}"
echo "condition=${RELEASE}" >> "$GITHUB_OUTPUT"
echo "version=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"
- name: Create release
if: steps.release.outputs.condition == 'true'
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048
with:
name: ${{ steps.release.outputs.version }}
tag_name: ${{ steps.release.outputs.version }}
generate_release_notes: true
target_commitish: ${{ env.GITHUB_REF }}
token: ${{ secrets.GH_RELEASES_TOKEN }}