Skip to content

Commit

Permalink
fix publish (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri authored Jul 19, 2024
1 parent 120ca52 commit 75be67e
Showing 1 changed file with 21 additions and 42 deletions.
63 changes: 21 additions & 42 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,28 @@
name: Publish rock (edge)
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Release to GHCR

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- '[0-9]-[0-9][0-9].[0-9][0-9]'
- 6-22.04
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/build.yaml
publish:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
name: Build rock
uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v16

release:
name: Release rock
needs:
- build
uses: canonical/data-platform-workflows/.github/workflows/release_rock.yaml@v16
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
permissions:
packages: write
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: 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: 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}_edge
sudo skopeo --insecure-policy copy \
oci-archive:charmed-mongodb_${rock_image_version}_amd64.rock \
docker-daemon:ghcr.io/canonical/charmed-mongodb:${tag}
docker push ghcr.io/canonical/charmed-mongodb:${tag}
packages: write # Needed to publish to GitHub Container Registry

0 comments on commit 75be67e

Please sign in to comment.