-
Notifications
You must be signed in to change notification settings - Fork 16
152 lines (133 loc) · 5.69 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
on:
push:
# ref: https://help.github.com/en/actions/reference/events-that-trigger-workflows#example-using-multiple-events-with-activity-types-or-configuration
tags:
- 'v*'
env:
# Authoritative Cirrus-CI task to monitor for completion info of all other cirrus-ci tasks.
MONITOR_TASK: 'MONITOR/TEST/VALUE'
# Authoritative Github Action task (in cirrus-ci) to trigger / check for completion of _this_ workflow
ACTION_TASK: 'ACTION/TEST/VALUE'
HELPER_LIB_TEST: 'github/test/run_action_tests.sh'
jobs:
smoke:
runs-on: ubuntu-latest
steps:
- name: Confirm privileged registry access
env:
DOCKER_CONFIG_JSON: ${{secrets.DOCKER_CONFIG_JSON}}
run: |
set +x
trap "history -c" EXIT
if [[ -z "$DOCKER_CONFIG_JSON" ]]; then
echo "::error::Empty/unset \$DOCKER_CONFIG_JSON for quay.io/libpod write access"
exit 1
fi
unit-tests: # N/B: Duplicates `ubuntu_unit_tests.yml` - templating not supported
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
# Testing installer requires a full repo. history
fetch-depth: 0
persist-credentials: false
path: ./
- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq -y install libtest-differences-perl libyaml-libyaml-perl
- name: Execute helper library unit-tests using code from PR
run: |
$GITHUB_WORKSPACE/$HELPER_LIB_TEST
- name: Fetch all repository tags
run: git fetch --tags --force
- name: Execute all unit-tests
run: $GITHUB_WORKSPACE/bin/run_all_tests.sh
release:
needs:
- unit-tests
- smoke
# Don't blindly trust the 'v*' push event filter.
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.')
runs-on: ubuntu-latest
steps:
# At the time of this comment, there is NO other source or method for
# obtaining the pushed tag from any function, env. var., event JSON, or
# context data.
- id: get_tag
name: Retrieve the tag name
run: printf "TAG_NAME=%s\n" $(basename "$GITHUB_REF") >> $GITHUB_OUTPUT
- id: create_release # Pre-req for upload-release-asset below
name: Create a new Github Release item for tag
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag.outputs.TAG_NAME }}
release_name: ${{ steps.get_tag.outputs.TAG_NAME }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: ./
- uses: actions/[email protected]
name: Upload the install script as the release artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/install_automation.sh
asset_name: install_automation.sh
asset_content_type: application/octet-stream
container_image:
needs:
- unit-tests
- smoke
runs-on: ubuntu-latest
env:
REGISTRY: quay.io
REPO_USER: libpod
REPO_NAME: cirrus-ci_retrospective
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: ./
- name: Build the cirrus-ci_retrospective container image
run: >-
docker build -t $REGISTRY/$REPO_USER/$REPO_NAME:latest \
-f cirrus-ci_retrospective/Dockerfile \
--build-arg INSTALL_AUTOMATION_VERSION=0.0.0 \
./
- name: Configure registry credentials
env:
DOCKER_CONFIG_JSON: ${{secrets.DOCKER_CONFIG_JSON}}
run: |
if [[ -z "$DOCKER_CONFIG_JSON" ]]; then
echo "::error::Empty/unset \$DOCKER_CONFIG_JSON"
exit 1
fi
trap "history -c" EXIT
mkdir -p $HOME/.docker
echo "$DOCKER_CONFIG_JSON" > $HOME/.docker/config.json
- name: Retrieve the tag name
id: get_tag
run: printf "TAG_NAME=%s\n" $(basename "$GITHUB_REF" | tee /dev/stderr) >> $GITHUB_OUTPUT
- name: Tag and push cirrus-ci_retrospective container image to registry
run: |
docker tag $REGISTRY/$REPO_USER/$REPO_NAME:latest \
$REGISTRY/$REPO_USER/$REPO_NAME:${{ steps.get_tag.outputs.TAG_NAME }}
docker push $REGISTRY/$REPO_USER/$REPO_NAME:${{ steps.get_tag.outputs.TAG_NAME }} && \
docker push $REGISTRY/$REPO_USER/$REPO_NAME:latest
debug:
runs-on: ubuntu-latest
steps:
- if: always()
name: Log colorized and formatted event JSON
run: jq --indent 4 --color-output . ${{ github.event_path }}
- if: always()
uses: actions/[email protected]
name: Archive triggering event JSON
with:
name: event.json.zip
path: ${{ github.event_path }}