-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (54 loc) · 1.79 KB
/
publish.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
name: Publish ROCK
on:
push:
branches:
- 3-22.04
jobs:
build:
uses: ./.github/workflows/build.yaml
publish:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Docker
run: |
sudo snap install docker
sudo addgroup --system docker; sudo adduser $USER docker
newgrp docker
sudo snap disable docker; sudo snap enable docker
- name: Install skopeo
run: |
sudo snap install --devmode --channel edge skopeo
- name: Install yq
run: |
sudo snap install yq
- uses: actions/download-artifact@v3
with:
name: charmed-zookeeper
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Import and push to GHCR
run: |
version=$(yq '(.version|split("-"))[0]' rockcraft.yaml)
base=$(yq '(.base|split("@"))[1]' rockcraft.yaml)
risk=edge
tag=${version}-${base}_${risk}
channel=$(echo ${{ github.ref_name }} | cut -d "-" -f 1)
ROCK_FILE=${{ needs.build.outputs.rock }}
sudo skopeo --insecure-policy copy \
oci-archive:$ROCK_FILE \
docker-daemon:ghcr.io/canonical/charmed-zookeeper:${tag}
docker tag \
ghcr.io/canonical/charmed-zookeeper:${tag} \
ghcr.io/canonical/charmed-zookeeper:${channel}_${risk}
docker push ghcr.io/canonical/charmed-zookeeper:${tag}
docker push ghcr.io/canonical/charmed-zookeeper:${channel}_${risk}