Merge pull request #7 from canonical/fix-security-manifest #5
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 to GHCR | |
env: | |
RELEASE: edge | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
uses: ./.github/workflows/build.yaml | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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 rockcraft.skopeo | |
run: | | |
sudo snap install rockcraft --classic | |
- name: Install yq | |
run: | | |
sudo snap install yq | |
- uses: actions/download-artifact@v3 | |
with: | |
name: valkey-rock | |
path: . | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USER }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Import and push to GHCR | |
run: | | |
version=$(yq '(.version|split("-"))[0]' rockcraft.yaml) | |
rock_image_version=$(yq '(.version)' rockcraft.yaml) | |
base=$(yq '(.base|split("@"))[1]' rockcraft.yaml) | |
tag=${version}-${base}-${{ env.RELEASE }} | |
echo "Publishing valkey:${tag}" | |
sudo rockcraft.skopeo --insecure-policy copy \ | |
oci-archive:valkey_${rock_image_version}_amd64.rock \ | |
docker-daemon:ghcr.io/canonical/valkey:${tag} | |
docker push ghcr.io/canonical/valkey:${tag} |