-
Notifications
You must be signed in to change notification settings - Fork 7
67 lines (59 loc) · 2.46 KB
/
publish_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
name: Release Ceph Rocks
# Only runs when a commit on release branches is tagged with ceph version string.
on:
push:
tags:
- v**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
release_to_registry:
name: Release Ceph rock to GHCR
runs-on: ubuntu-22.04
permissions:
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Setup LXD
uses: canonical/[email protected]
with:
channel: 5.21/edge
- name: Install deps and clean legacy rules.
run: |
sudo snap install docker
sudo snap install rockcraft --classic --channel latest/stable
for ipt in iptables iptables-legacy ip6tables ip6tables-legacy; do sudo $ipt --flush; sudo $ipt --flush -t nat; sudo $ipt --delete-chain; sudo $ipt --delete-chain -t nat; sudo $ipt -P FORWARD ACCEPT; sudo $ipt -P INPUT ACCEPT; sudo $ipt -P OUTPUT ACCEPT; done
sudo systemctl reload snap.lxd.daemon
sleep 5
- name: Patch version information into rock recipe
id: versioning
run: |
PKG_VER_STR=$(sudo rockcraft pull pkg_info -v &> >(grep "Version"))
PKG_VER=$(cut -d' ' -f3 <<< $PKG_VER_STR | tr "~" "_")
CEPH_VER=$(cut -d'-' -f1 <<< $PKG_VER)
sed -i "/version:/c\version: $CEPH_VER" rockcraft.yaml
echo "::set-output name=ceph_version::$CEPH_VER"
echo "::set-output name=pkg_version::$PKG_VER"
- name: login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/canonical/ceph
tags: |
type=semver,pattern={{version}}
type=raw,value=${{ steps.versioning.outputs.pkg_version }}
type=raw,value=quincy,enable=${{ startsWith(steps.versioning.outputs.ceph_version, '17') }}
type=raw,value=reef,enable=${{ startsWith(steps.versioning.outputs.ceph_version, '18') }}
- name: Prepare Rock
run: ./scripts/test-helper.sh build_rock
- name: Load to Docker daemon
run: ./scripts/test-helper.sh load_to_docker $TAGS
env:
TAGS: ${{ steps.meta.outputs.tags }}