forked from podtato-head/podtato-head
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (108 loc) · 3.76 KB
/
release-tasks.yaml
File metadata and controls
117 lines (108 loc) · 3.76 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: release-tasks
on:
workflow_dispatch:
inputs:
release_build:
description: 'is this a release build?'
required: false
type: boolean
default: "false"
apply_git_tag:
description: 'should we apply git tag?'
required: false
type: boolean
default: "false"
git_tag:
description: 'If set, override calculated tag'
required: false
type: string
default: ""
apply_image_tag:
description: 'should we apply image tag?'
required: false
type: boolean
default: "false"
image_tag:
description: 'If set, override calculated tag'
required: false
type: string
default: ""
env:
CONTAINER_REGISTRY: ghcr.io
GITHUB_USER: ${{ github.repository_owner }}
# for access to ghcr.io/podtato-head instead of ghcr.io/podtato-head/podtato-head
GITHUB_TOKEN: ${{ github.token }}
defaults:
run:
shell: bash
jobs:
tag_and_push_images:
if: github.event.inputs.apply_image_tag == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install requirements
run: ./scripts/requirements.sh "/usr/local/bin"
- name: Set image tag to apply
run: |
IMAGE_VERSION=${{ github.event.inputs.image_tag }}
echo "IMAGE_VERSION=${IMAGE_VERSION}" >> $GITHUB_ENV
echo "IMAGE_VERSION: ${IMAGE_VERSION}"
echo "INFO: if IMAGE_VERSION isn't specified it will be determined dynamically"
if [[ "${{ github.event.inputs.release_build }}" == 'true' ]]; then
echo "INFO: release_build set, will push to ghcr.io/podtato-head"
echo "RELEASE_BUILD=1" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.CR_PAT }}" >> $GITHUB_ENV
else
echo "INFO: release_build not set, will push to ghcr.io/podtato-head/${GITHUB_USER}"
fi
- name: Push image with tag
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: make push-microservices-images
test_services:
if: github.event.inputs.apply_image_tag == 'true' || github.event.inputs.apply_git_tag == 'true'
needs: tag_and_push_images
runs-on: ubuntu-latest
steps:
- name: Set image tag to use
run: |
IMAGE_VERSION=${{ github.event.inputs.image_tag }}
echo "IMAGE_VERSION=${IMAGE_VERSION}" >> $GITHUB_ENV
echo "IMAGE_VERSION: ${IMAGE_VERSION}"
echo "INFO: if IMAGE_VERSION isn't specified it will be determined dynamically"
# don't automatically increment tag here
export NO_INCREMENT=1
if [[ "${{ github.event.inputs.release_build }}" == 'true' ]]; then
echo "RELEASE_BUILD=1" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.CR_PAT }}" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v3
- name: Test services
run: make test-microservices
tag_git_repo:
if: github.event.inputs.apply_git_tag == 'true'
needs:
- test_services
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set git tag string
run: |
REPO_VERSION=${{ github.event.inputs.repo_tag }}
echo "REPO_VERSION=${REPO_VERSION}" >> $GITHUB_ENV
echo "REPO_VERSION: ${REPO_VERSION}"
echo "INFO: if REPO_VERSION isn't specified it will be determined dynamically"
- name: Apply new git tag
run: |
version=$(./scripts/repo_version.sh)
echo "INFO: will tag latest commit as: ${version}"
git tag -f "${version}"
git push --tags