Skip to content

Commit 6978657

Browse files
committed
ci: apply oci-factory backport
1 parent dfe512c commit 6978657

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ jobs:
2424
uses: ./.github/workflows/publish.yaml
2525
with:
2626
rock: ${{ needs.build.outputs.rock }}
27+
secrets:
28+
token: ${{ secrets.PAT_TOKEN }}
2729
scan:
2830
if: ${{ (github.ref == 'refs/heads/main') || (github.ref_type == 'tag') }}
2931
needs: publish
3032
uses: ./.github/workflows/scan.yaml
3133
with:
32-
image: ${{ needs.publish.outputs.image }}
34+
image: ${{ needs.publish.outputs.image }}

.github/workflows/publish.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ run-name: Publish container from ${{ inputs.rock }} to ghcr.io/canonical/identit
33

44
on:
55
workflow_call:
6+
secrets:
7+
token:
8+
required: true
69
inputs:
710
rock:
811
type: string
@@ -64,3 +67,33 @@ jobs:
6467
id: set
6568
run: echo "image=$image" >> "$GITHUB_OUTPUT"
6669

70+
oci-factory:
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
75+
- name: Golang setup
76+
uses: actions/setup-go@v5
77+
with:
78+
go-version: '>=1.22.0'
79+
# install oci-factory via golang and set path in environment
80+
- name: Install oci-factory
81+
run: |
82+
sudo apt update && sudo apt install -y git
83+
go install github.com/canonical/oci-factory/tools/cli-client/cmd/oci-factory@latest
84+
go install github.com/mikefarah/yq/v4@v4.44.3
85+
echo "OCI_FACTORY=$(go env GOPATH)/bin/oci-factory" >> $GITHUB_ENV
86+
echo "YQ=$(go env GOPATH)/bin/yq" >> $GITHUB_ENV
87+
env:
88+
GO111MODULE: "on"
89+
- name: Set EOLs and version
90+
run: |
91+
echo EOL_STABLE=$(date -d "$(date +'%Y-%m-%d') +6 month" "+%Y-%m-%d") >> $GITHUB_ENV
92+
echo EOL_CANDIDATE=$(date -d "$(date +'%Y-%m-%d') +14 day" "+%Y-%m-%d") >> $GITHUB_ENV
93+
echo IMAGE_VERSION_STABLE=$($YQ '.version | split(".").0' rockcraft.yaml) >> $GITHUB_ENV
94+
echo IMAGE_VERSION_CANDIDATE=$($YQ '.version' rockcraft.yaml) >> $GITHUB_ENV
95+
- name: Release
96+
run: |
97+
$OCI_FACTORY upload -y --release track=$IMAGE_VERSION_CANDIDATE-22.04,risks=candidate,edge,eol=$EOL_CANDIDATE
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.token }}

0 commit comments

Comments
 (0)