-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (64 loc) · 2.21 KB
/
release.yaml
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
name: Publish to GHCR
env:
RELEASE: edge
on:
push:
branches:
- main
jobs:
ci-tests:
name: Build and Run Tests
uses: ./.github/workflows/ci.yaml
publish:
name: publish
runs-on: [self-hosted, linux, X64, jammy, large]
timeout-minutes: 15
needs:
- ci-tests
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install required dependencies
run: |
# docker
sudo snap install docker
sudo addgroup --system docker; sudo adduser $USER docker
newgrp docker
sudo snap disable docker; sudo snap enable docker
# skopeo
sudo snap install --devmode --channel edge skopeo
# yq
sudo snap install yq
- name: Download rock file
uses: actions/download-artifact@v3
with:
name: charmed_opensearch_rock_amd64
path: .
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Publish rock to Store
run: |
version="$(cat rockcraft.yaml | yq .version)"
base="$(cat rockcraft.yaml | yq .base)"
base="${base#*:}"
# push major version to edge
major_tag_version="${version%%.*}-${{ env.RELEASE }}"
sudo skopeo \
--insecure-policy \
copy \
oci-archive:charmed-opensearch_${version}_amd64.rock \
docker-daemon:ghcr.io/canonical/charmed-opensearch:${major_tag_version}
docker push ghcr.io/canonical/charmed-opensearch:${major_tag_version}
### push full version to edge
tag_version="${version}-${base}_${{ env.RELEASE }}"
echo "Publishing charmed-opensearch:${tag_version}"
sudo skopeo \
--insecure-policy \
copy \
oci-archive:charmed-opensearch_${version}_amd64.rock \
docker-daemon:ghcr.io/canonical/charmed-opensearch:${tag_version}
docker push ghcr.io/canonical/charmed-opensearch:${tag_version}