Skip to content

Merge pull request #4 from canonical/fix_release_workflow #3

Merge pull request #4 from canonical/fix_release_workflow

Merge pull request #4 from canonical/fix_release_workflow #3

Workflow file for this run

name: Publish to GHCR
env:
RELEASE: edge
on:
push:
branches:
- main
jobs:
ci-tests:
name: Build
uses: ./.github/workflows/ci.yaml
publish:
name: publish
runs-on: ubuntu-latest
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: mongodb_benchmarking_oci_rock_amd64
path: .
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_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:mongodb-benchmarking-oci_${version}_amd64.rock \
docker-daemon:ghcr.io/canonical/mongodb-benchmarking:${major_tag_version}
docker push ghcr.io/canonical/mongodb-benchmarking:${major_tag_version}