-
Notifications
You must be signed in to change notification settings - Fork 1
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 #125 from canonical/ci/oci-factory
ci: add oci-factory machinery
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -3,6 +3,9 @@ name: Publish | |
|
||
on: | ||
workflow_call: | ||
secrets: | ||
token: | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
|
@@ -45,3 +48,33 @@ jobs: | |
oci-archive:"${rock_file}" \ | ||
docker-daemon:"ghcr.io/canonical/${image_name}:${version}" | ||
docker push ghcr.io/canonical/${image_name}:${version} | ||
oci-factory: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | ||
- name: Golang setup | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '>=1.22.0' | ||
# install oci-factory via golang and set path in environment | ||
- name: Install oci-factory | ||
run: | | ||
sudo apt update && sudo apt install -y git | ||
go install github.com/canonical/oci-factory/tools/cli-client/cmd/oci-factory@latest | ||
go install github.com/mikefarah/yq/[email protected] | ||
echo "OCI_FACTORY=$(go env GOPATH)/bin/oci-factory" >> $GITHUB_ENV | ||
echo "YQ=$(go env GOPATH)/bin/yq" >> $GITHUB_ENV | ||
env: | ||
GO111MODULE: "on" | ||
- name: Set EOLs and version | ||
# special case for hydra due to the canonical fork | ||
run: | | ||
echo EOL_STABLE=$(date -d "$(date +'%Y-%m-%d') +3 month" "+%Y-%m-%d") >> $GITHUB_ENV | ||
echo IMAGE_VERSION_STABLE=$($YQ '.version | split(".").0' rockcraft.yaml) >> $GITHUB_ENV | ||
- name: Release | ||
run: | | ||
$OCI_FACTORY upload -y --release track=$IMAGE_VERSION_STABLE-22.04,risks=stable,eol=$EOL_STABLE | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.token }} |