-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (43 loc) · 1.49 KB
/
tag-version.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
name: Tag new versions
on:
repository_dispatch:
types:
- test-pass
- tag-push
env:
UPDATE_VERSION_POLICY: '{ "dev": "patch", "staging": "minor", "prod": "major" }'
CHECKOUT_REF: ${{ github.event.client_payload.tag || 'master' }}
ENV: ${{ github.event.client_payload.env }}
SERVICE_NAME: ${{ github.event.client_payload.service_name }}
IMAGE_TAG: ${{ github.event.client_payload.image_tag }}
jobs:
bump-tag:
runs-on: self-hosted
steps:
- uses: actions/checkout@master
with:
fetch-depth: '0'
ref: ${{ env.CHECKOUT_REF }}
- name: Update envs .json file (dev)
if: ${{ env.ENV == 'dev' }}
env:
FILENAME: ./envs/dev.json
run: ./envs/bump.sh
- name: Update envs .json file (staging)
if: ${{ env.ENV == 'staging' }}
run: cp ./env/dev.json ./env/staging.json
- name: Update envs .json file (prod)
if: ${{ env.ENV == 'prod' }}
run: cp ./env/staging.json ./env/prod.json
- name: Commit and push updated .json file
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: envs/*.json
commit_message: "chore(${{ env.ENV }}): bump ${{ env.SERVICE_NAME }}:${{ env.IMAGE_TAG }}"
push_options: '--force'
- name: Create and push tag
uses: anothrNick/github-tag-action@master
env:
GITHUB_TOKEN: ${{ secrets.TENDERBOT_GIT_TOKEN }}
RELEASE_BRANCHES: .*
DEFAULT_BUMP: ${{ fromJson(env.UPDATE_VERSION_POLICY)[env.ENV] }}