forked from openstack-snaps/ubuntu-openstack-rocks
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from gboutry/refactor/actions
Refactor github actions
- Loading branch information
Showing
7 changed files
with
104 additions
and
108 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish Rock to Registry | ||
description: Publishes a Rock package to the GHCR registry | ||
inputs: | ||
rock: | ||
description: Path to a .rock file | ||
required: true | ||
username: | ||
description: Username to use for the registry | ||
required: true | ||
password: | ||
description: Password to use for the registry | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@40891eba8c2bcd1309b07ba8b11232f313e86779 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ inputs.username }} | ||
password: ${{ inputs.password }} | ||
- name: Install skopeo | ||
shell: bash | ||
run: sudo snap install --devmode --channel edge skopeo | ||
- name: Install yq | ||
shell: bash | ||
run: sudo snap install yq | ||
- name: Import and push to github package | ||
shell: bash | ||
run: | | ||
rock_file="${{ inputs.rock }}" | ||
rockdir=$(dirname $rock_file) | ||
image_name="$(yq '.name' $rockdir/rockcraft.yaml)" | ||
version="$(yq '.version' $rockdir/rockcraft.yaml)" | ||
sudo skopeo \ | ||
--insecure-policy \ | ||
copy \ | ||
oci-archive:"${rock_file}" \ | ||
docker-daemon:"ghcr.io/canonical/${image_name}:${version}" | ||
echo "Publishing rock ${image_name}:${version}" | ||
docker push ghcr.io/canonical/${image_name}:${version} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Push | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
rocks: | ||
description: List of rocks to build | ||
required: true | ||
type: string | ||
default: '[]' | ||
publish: | ||
description: Publish rocks ? | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
build-and-publish: | ||
if: ${{ inputs.rocks != '[]' }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rock: ${{ fromJson(inputs.rocks) }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- uses: canonical/craft-actions/rockcraft-pack@main | ||
id: rockcraft | ||
with: | ||
path: rocks/${{ matrix.rock }} | ||
- uses: ./.github/actions/publish-rock | ||
if: ${{ inputs.publish }} | ||
with: | ||
rock: ${{ steps.rockcraft.outputs.rock }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} |
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
This file was deleted.
Oops, something went wrong.
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
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
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