-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply workaround from actions/toolkit#1264 to find workflow ref
- Loading branch information
Showing
1 changed file
with
29 additions
and
12 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 |
---|---|---|
|
@@ -21,23 +21,37 @@ jobs: | |
name: Create Mulitarch Manifest | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Get Workflow Reference | ||
id: workflow-ref | ||
- name: Checkout calling repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Get workflow reference | ||
id: workflows-ref | ||
run: | | ||
if [ -n "${{ github.workflow_ref }}" ]; then | ||
IFS='@' read -r WORKFLOW_REPO WORKFLOW_REF << ${{ github.workflow_ref }} | ||
echo "WORKFLOW_REPO=$WORKFLOW_REPO" >> $GITHUB_ENV | ||
echo "WORKFLOW_REF=$WORKFLOW_REF" >> $GITHUB_ENV | ||
fi | ||
- uses: actions/[email protected] | ||
workflow_ref=${{ github.workflow_ref }} | ||
repository="${{ github.repository }}/" | ||
repo_ref="@${{ github.ref }}" | ||
workflow_path=${workflow_ref#"$repository"} | ||
workflow_path=${workflow_path%"$repo_ref"} | ||
ref=$(cat ${workflow_path} | grep assemble_multiarch_image | cut -d"@" -f2) | ||
echo "ref=${ref}" >> ${GITHUB_OUTPUT} | ||
- name: Checkout workflows | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.WORKFLOW_REPO || github.repository }} | ||
ref: ${{ env.WORKFLOW_REF }} | ||
repository: canonical/k8s-workflows | ||
ref: ${{ steps.workflows-ref.outputs.ref }} | ||
path: workflows | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- id: assemble-image-tags-js | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: .github/files/assemble-image-tags.js | ||
path: workflows/.github/files/assemble-image-tags.js | ||
trim: true | ||
|
||
- name: Assemble Image Tags | ||
id: assemble-image-tags | ||
uses: actions/[email protected] | ||
|
@@ -46,17 +60,20 @@ jobs: | |
const rockMetas = JSON.parse(`${{ inputs.rock-metas }}`) | ||
${{ steps.assemble-image-tags-js.outputs.content }} | ||
await main(rockMetas) | ||
- name: Login to Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ inputs.registry }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- id: create-and-push-manifest-js | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: .github/files/create-and-push-manifest.js | ||
path: workflows/.github/files/create-and-push-manifest.js | ||
trim: true | ||
|
||
- name: Create and Push Manifests | ||
id: create-and-push-manifest | ||
uses: actions/[email protected] | ||
|