Skip to content

Fix release pipeline of Rock #46

Fix release pipeline of Rock

Fix release pipeline of Rock #46

Workflow file for this run

name: Publish to GHCR
env:
RELEASE: edge
on:
pull_request:
push:
branches:
- 6-22.04
jobs:
publish:

Check failure on line 13 in .github/workflows/publish.yaml

View workflow run for this annotation

GitHub Actions / Publish to GHCR

Invalid workflow file

The workflow is not valid. .github/workflows/publish.yaml (Line: 13, Col: 3): The workflow must contain at least one job with no dependencies.
needs: build
name: publish
runs-on: ubuntu-latest
timeout-minutes: 15
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
- uses: actions/download-artifact@v3
with:
name: mongodb-rock
- 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)"
version="${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-mongodb_${version}_amd64.rock \
docker-daemon:ghcr.io/canonical/charmed-mongodb:${major_tag_version}
docker push ghcr.io/canonical/charmed-mongodb:${major_tag_version}
### push full version to edge
tag_version="${version}-${base}_${{ env.RELEASE }}"
echo "Publishing charmed-mongodb:${tag_version}"
sudo skopeo \
--insecure-policy \
copy \
oci-archive:charmed-mongodb_${version}_amd64.rock \
docker-daemon:ghcr.io/canonical/charmed-mongodb:${tag_version}
docker push ghcr.io/canonical/charmed-mongodb:${tag_version}