Rename version and dump only rock license into the image (#32) #26
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: Publish ROCK | |
on: | |
push: | |
branches: | |
- 8.0-22.04 | |
workflow_dispatch: | |
branches: | |
- 8.0-22.04 | |
jobs: | |
sbom: | |
uses: ./.github/workflows/sbom.yaml | |
publish: | |
needs: sbom | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
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-mysql-rock | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USER }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Push image to GHCR | |
run: | | |
app=$(yq .name rockcraft.yaml) | |
version=$(yq '(.version)' rockcraft.yaml) | |
base=$(yq '(.base|split(":"))[1]' rockcraft.yaml) | |
tag=${version}-${base}_edge | |
sudo skopeo --insecure-policy copy \ | |
oci-archive:${app}_${tag}_amd64.rock \ | |
docker-daemon:ghcr.io/canonical/${app}:${tag} | |
docker push ghcr.io/canonical/${app}:${tag} |