From 7f120c8170cb556aba9896eb7efeea8b28003b7f Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 3 Sep 2024 14:53:13 -0400 Subject: [PATCH 1/7] Push image to prod ACR with unique tag --- .github/workflows/pr.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e31975b8..7384ad12 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,6 +11,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: 'Get Previous tag' + id: most-recent-tag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + + - name: TEMPORARY + run: echo ${{ github.run_number }} && echo ${{ github.ref_name }} && echo ${{ steps.most-recent-tag.outputs.tag }} + - name: Set Azurite Default Key run: echo "AZURITE_ACCOUNT_KEY=$(curl https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite | grep "Account key:" | cut -b 24-111)" >> $GITHUB_ENV @@ -25,6 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: "3.10" # stac-api-validator requires >= 3.10 From a70782d821eb9b2a00d1b94ff9b4349d17a985c6 Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 3 Sep 2024 15:10:29 -0400 Subject: [PATCH 2/7] remove hyphens --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7384ad12..77384a26 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,11 +12,11 @@ jobs: - uses: actions/checkout@v3 - name: 'Get Previous tag' - id: most-recent-tag + id: mostrecenttag uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: TEMPORARY - run: echo ${{ github.run_number }} && echo ${{ github.ref_name }} && echo ${{ steps.most-recent-tag.outputs.tag }} + run: echo ${{ github.run_number }} && echo ${{ github.ref_name }} && echo ${{ steps.mostrecenttag.outputs.tag }} - name: Set Azurite Default Key run: echo "AZURITE_ACCOUNT_KEY=$(curl https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite | grep "Account key:" | cut -b 24-111)" >> $GITHUB_ENV From 3998048c3d3d01fea7980b44ce3558c0857e5170 Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 3 Sep 2024 15:14:16 -0400 Subject: [PATCH 3/7] add fetch depth --- .github/workflows/pr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 77384a26..a3c1ec0a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -10,13 +10,15 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: 'Get Previous tag' - id: mostrecenttag + id: most-recent-tag uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: TEMPORARY - run: echo ${{ github.run_number }} && echo ${{ github.ref_name }} && echo ${{ steps.mostrecenttag.outputs.tag }} + run: echo ${{ github.run_number }} && echo ${{ github.ref_name }} && echo ${{ steps.most-recent-tag.outputs.tag }} - name: Set Azurite Default Key run: echo "AZURITE_ACCOUNT_KEY=$(curl https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite | grep "Account key:" | cut -b 24-111)" >> $GITHUB_ENV From d5c43832736d73e01dc9c1134e0826cdf0a1e927 Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 3 Sep 2024 15:15:58 -0400 Subject: [PATCH 4/7] format string --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a3c1ec0a..bb8e6560 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -18,7 +18,7 @@ jobs: uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: TEMPORARY - run: echo ${{ github.run_number }} && echo ${{ github.ref_name }} && echo ${{ steps.most-recent-tag.outputs.tag }} + run: echo (${{ steps.most-recent-tag.outputs.tag }}.${{ github.run_number }}) - name: Set Azurite Default Key run: echo "AZURITE_ACCOUNT_KEY=$(curl https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite | grep "Account key:" | cut -b 24-111)" >> $GITHUB_ENV From 14ed9c8794dd0758bebd92728f30ea82c96b875c Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 3 Sep 2024 15:20:29 -0400 Subject: [PATCH 5/7] tweaks --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bb8e6560..0530da81 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,12 +13,12 @@ jobs: with: fetch-depth: 0 - - name: 'Get Previous tag' + - name: Get Most Recent Tag id: most-recent-tag uses: "WyriHaximus/github-action-get-previous-tag@v1" - - name: TEMPORARY - run: echo (${{ steps.most-recent-tag.outputs.tag }}.${{ github.run_number }}) + - name: Echo Full Tag + run: echo ${{ steps.most-recent-tag.outputs.tag }}.${{ github.run_number }} - name: Set Azurite Default Key run: echo "AZURITE_ACCOUNT_KEY=$(curl https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite | grep "Account key:" | cut -b 24-111)" >> $GITHUB_ENV From e4b2dc61e88cb33b491fe38ac9d70aa1f02b74a9 Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 3 Sep 2024 15:58:43 -0400 Subject: [PATCH 6/7] cicd --- .github/workflows/cicd.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index d814f9ee..ef13bf55 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -16,6 +16,12 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get Most Recent Tag + id: most-recent-tag + uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: Log in with Azure uses: azure/login@v1 @@ -35,25 +41,25 @@ jobs: - name: Run cibuild run: ./scripts/cibuild - - name: Get image tag - id: get_image_tag + - name: Publish Image + id: publish_image run: case "${GITHUB_REF}" in *tags*) echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT ; - echo "acr=pccomponents" >> $GITHUB_OUTPUT + ./scripts/cipublish --acr pccomponents --tag ${{tag}} ;; *) + echo "Publishing to pccomponentstest as latest" ; echo "tag=latest" >> $GITHUB_OUTPUT ; - echo "acr=pccomponentstest" >> $GITHUB_OUTPUT + ./scripts/cipublish --acr pccomponentstest --tag latest ; + echo "Also publishing to pccomponents ACR with unique tag" ; + ./scripts/cipublish --acr pccomponents --tag ${{ steps.most-recent-tag.outputs.tag }}.${{ github.run_number }} ;; esac - - name: Publish images - run: ./scripts/cipublish --acr ${{steps.get_image_tag.outputs.acr}} --tag ${{steps.get_image_tag.outputs.tag}} - outputs: - image_tag: ${{ steps.get_image_tag.outputs.tag }} + image_tag: ${{ steps.publish_image.outputs.tag }} deploy: runs-on: ubuntu-latest From c4a6b080281dbef1b83278685d5447aace38c705 Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 3 Sep 2024 15:58:55 -0400 Subject: [PATCH 7/7] revert pr --- .github/workflows/pr.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0530da81..e31975b8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -10,15 +10,6 @@ jobs: steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Get Most Recent Tag - id: most-recent-tag - uses: "WyriHaximus/github-action-get-previous-tag@v1" - - - name: Echo Full Tag - run: echo ${{ steps.most-recent-tag.outputs.tag }}.${{ github.run_number }} - name: Set Azurite Default Key run: echo "AZURITE_ACCOUNT_KEY=$(curl https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite | grep "Account key:" | cut -b 24-111)" >> $GITHUB_ENV @@ -34,7 +25,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 with: python-version: "3.10" # stac-api-validator requires >= 3.10