Merge pull request #52 from canonical/fix/releaseJobs #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
outputs: | |
rock: ${{ steps.rockcraft.outputs.rock }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Setup LXD | |
uses: canonical/[email protected] | |
with: | |
channel: 5.20/stable | |
- name: Install deps and clean legacy rules. | |
run: | | |
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) | |
CEPH_VER=$(cut -d'-' -f1 <<< $PKG_VER) | |
sed -i "/version:/c\version: $CEPH_VER" rockcraft.yaml | |
echo "{ceph_version}={$CEPH_VER}" >> $GITHUB_OUTPUT | |
echo "{pkg_version}={$PKG_VER}" >> $GITHUB_OUTPUT | |
- 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 | |
uses: canonical/craft-actions/rockcraft-pack@main | |
id: rockcraft | |
- name: Load to Docker daemon | |
run: | | |
# iterate through the tags | |
for tag in $TAGS; do | |
echo "$tag" | |
skopeo --insecure-policy copy oci-archive:${{ steps.rockcraft.outputs.rock }} docker-daemon:$tag | |
done | |
docker image ls -a | |
sleep 10 | |
docker push ghcr.io/canonical/ceph --all-tags | |
env: | |
TAGS: ${{ steps.meta.outputs.tags }} |