Skip to content

Commit

Permalink
Update publish-image-acr.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Heba Elayoty <[email protected]>
  • Loading branch information
helayoty authored Oct 17, 2023
1 parent 043e841 commit 3ca11f1
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions .github/workflows/publish-image-acr.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Push image to ACR
on:
workflow_dispatch:
workflow_run:
workflows: [ "Create release" ]
types: [ completed ]
branches: [release-** ]


permissions:
Expand All @@ -17,52 +13,15 @@ env:

jobs:
publish:
if: |
always() &&
(github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-20.04
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Download tag artifact
uses: actions/github-script@v6
with:
github-token: ${{ secrets.KDM_ACCESS_TOKEN_READ }}
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "artifacts"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`/tmp/artifacts.zip`, Buffer.from(download.data));
- run: |
mkdir -p /tmp/artifacts
unzip /tmp/artifacts.zip -d /tmp/artifacts
shell: bash
- run: |
echo "Downloaded artifacts:"
ls -ablh /tmp/artifacts
shell: bash
- name: Parse artifacts and assign GA environment variables
- name: Set Image Tag
run: |
tag=$(tail -n 1 /tmp/artifacts/tag.txt)
tag=${{ github.ref }}
echo "IMG_TAG=$tag" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
Expand Down

0 comments on commit 3ca11f1

Please sign in to comment.