-
Notifications
You must be signed in to change notification settings - Fork 244
44 lines (39 loc) · 1.32 KB
/
cd.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
name: CD
on:
workflow_dispatch:
inputs:
update-tag:
description: "input yes means bump up tag version, and no means update the tag to top"
required: true
default: "no"
jobs:
cd:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
steps:
- name: Validate CD branch
if: ${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/release' && github.ref != 'refs/heads/main' }}
run: |
echo It's not allowed to run CD on other branch except release.
exit 1
- uses: actions/checkout@v2
- name: fetch latest tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: update tag
uses: richardsimko/update-tag@v1
if: ${{ github.event.inputs.update-tag == 'no' }}
with:
tag_name: ${{ steps.get-latest-tag.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version and push tag
if: ${{ github.event.inputs.update-tag != 'no' }}
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
INITIAL_VERSION: ${{ steps.get-latest-tag.outputs.tag }}
RELEASE_BRANCHES: "main"