-
Notifications
You must be signed in to change notification settings - Fork 172
59 lines (58 loc) · 2.2 KB
/
tag-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
name: Tag and Release
on:
workflow_dispatch:
inputs:
tag-name:
description: 'Tag to give this release (will increment patch version by default)'
required: false
commit-ref:
description: 'Branch or SHA to tag (defaults to master)'
required: false
workflow_call:
jobs:
release:
name: Create Release
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2.2.0
with:
fetch-depth: 0
- name: Get Previous Tag
id: get-previous-tag
run: echo "::set-output name=tag::`git tag -l --sort=creatordate 'v*.*.*' | tail -n 1`"
if: ${{ github.event.inputs.tag-name == null }}
- name: Get Next Tags
id: get-next-tags
uses: WyriHaximus/github-action-next-semvers@v1.0
if: ${{ github.event.inputs.tag-name == null }}
with:
version: ${{ steps.get-previous-tag.outputs.tag }}
- name: Set Explicit Tag Variable
# If we have explicitly passed in a tag, use that
if: ${{ github.event.inputs.tag-name != null }}
run: echo "NEW_TAG=${{ github.event.inputs.tag-name }}" >> $GITHUB_ENV
- name: Set Calculated Tag Variable
# If we haven't explicitly passed in a tag, use the next patch version determined above
if: ${{ github.event.inputs.tag-name == null }}
run: echo "NEW_TAG=${{ steps.get-next-tags.outputs.v_patch }}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.NEW_TAG }}
release_name: Release ${{ env.NEW_TAG }}
commitish: ${{ github.event.inputs.commit-ref || 'master' }}
body: Release ${{ env.NEW_TAG }}
draft: false
prerelease: false
- name: Trigger production deploy
uses: peter-evans/repository-dispatch@v1.1.1
with:
token: ${{ secrets.DEPLOY_REPO_ACCESS_TOKEN }}
repository: concrete-utopia/utopia-deploy
event-type: trigger-production-deploy
client-payload: '{"commit-ref": "${{ env.NEW_TAG }}"}'