From 03f6eeae7908281b93e6fe53422c7416d929ff5a Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Mon, 22 Jan 2024 12:47:41 +1100 Subject: [PATCH 1/5] Combine workflow for UID2 and EUID --- .../workflows/release-docker-image-uid2.yaml | 23 ----- .github/workflows/release-docker-image.yaml | 86 +++++++++++++++++++ package.json | 2 +- 3 files changed, 87 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/release-docker-image-uid2.yaml create mode 100644 .github/workflows/release-docker-image.yaml diff --git a/.github/workflows/release-docker-image-uid2.yaml b/.github/workflows/release-docker-image-uid2.yaml deleted file mode 100644 index f17fc6e..0000000 --- a/.github/workflows/release-docker-image-uid2.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Release UID2 TCPORTAL Image -run-name: ${{ inputs.release_type == 'Snapshot' && 'Publish Pre-release' || format('Release {0}', inputs.release_type)}} UID2 Docker Image by @${{ github.actor }} -on: - workflow_dispatch: - inputs: - release_type: - type: choice - description: 'The type of release' - options: - - Major - - Minor - - Patch - - Snapshot - -jobs: - Image: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v2 - with: - release_type: ${{ inputs.release_type }} - docker_file: Dockerfile_uid2 - docker_image_name: iabtechlab/uid2-tcportal - docker_registry: ghcr.io - secrets: inherit diff --git a/.github/workflows/release-docker-image.yaml b/.github/workflows/release-docker-image.yaml new file mode 100644 index 0000000..f3dfcc2 --- /dev/null +++ b/.github/workflows/release-docker-image.yaml @@ -0,0 +1,86 @@ +name: Release TCPORTAL Image +run-name: ${{ inputs.release_type == 'Snapshot' && 'Publish Pre-release' || format('Release {0}', inputs.release_type)}} Docker Image by @${{ github.actor }} +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: 'The type of release' + options: + - Major + - Minor + - Patch + - Snapshot + pull_request: + +jobs: + bumpVersion: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + outputs: + new_version: ${{ steps.version.outputs.new_version }} + image_tag: ${{ steps.updatePackageJson.outputs.image_tag }} + steps: + - name: Setup + id: setup + uses: IABTechLab/uid2-shared-actions/actions/shared_publish_setup@v2 + with: + release_type: ${{ inputs.release_type }} + + - name: Set version number + id: version + uses: IABTechLab/uid2-shared-actions/actions/version_number@v2 + with: + type: ${{ inputs.release_type }} + version_number: ${{ inputs.version_number_input }} + branch_name: ${{ github.ref }} + + - name: Update package.json + id: updatePackageJson + run: | + current_version=$(jq -r '.version') + new_version=${{ steps.version.outputs.new_version }} + jq --arg v "$new_version" ".version = \$v" "package.json" > tmp.json && mv tmp.json "package.json" + echo "Version number updated from $current_version to $new_version" + echo "image_tag=${{ steps.version.outputs.new_version }}" >> $GITHUB_OUTPUT + + - name: Commit package.json + if: ${{ inputs.version_number_input == '' && steps.checkRelease.outputs.IS_RELEASE != 'true' }} + uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main + with: + add: 'package.json' + message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}' + + - name: Commit package.json and set tag + if: ${{ inputs.version_number_input == '' && steps.checkRelease.outputs.IS_RELEASE == 'true' }} + uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main + with: + add: 'package.json' + message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}' + tag: v${{ steps.version.outputs.new_version }} + + publishToUID2: + uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned + needs: bumpVersion + with: + new_version: ${{ needs.bumpVersion.outputs.new_version }} + image_tag: ${{ needs.bumpVersion.outputs.image_tag }} + release_type: ${{ inputs.release_type }} + docker_file: Dockerfile_uid2 + docker_image_name: iabtechlab/uid2-tcportal + docker_registry: ghcr.io + secrets: inherit + + publishToEUID: + uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned + needs: bumpVersion + with: + new_version: ${{ needs.bumpVersion.outputs.new_version }} + image_tag: ${{ needs.bumpVersion.outputs.image_tag }} + release_type: ${{ inputs.release_type }} + docker_file: Dockerfile_euid + docker_image_name: iabtechlab/euid-tcportal + docker_registry: ghcr.io + secrets: inherit diff --git a/package.json b/package.json index 224dc51..a93d4fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tc-portal", - "version": "1.3.1-e95732731f", + "version": "1.3.1", "private": true, "engineStrict": true, "scripts": { From 12d8e888bb9b276d8831122fa38ae6f85ea3dcaa Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Mon, 22 Jan 2024 13:42:42 +1100 Subject: [PATCH 2/5] Use shared actions for bumpVersion --- .github/workflows/release-docker-image.yaml | 49 ++------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/.github/workflows/release-docker-image.yaml b/.github/workflows/release-docker-image.yaml index f3dfcc2..cc66c98 100644 --- a/.github/workflows/release-docker-image.yaml +++ b/.github/workflows/release-docker-image.yaml @@ -15,51 +15,10 @@ on: jobs: bumpVersion: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - outputs: - new_version: ${{ steps.version.outputs.new_version }} - image_tag: ${{ steps.updatePackageJson.outputs.image_tag }} - steps: - - name: Setup - id: setup - uses: IABTechLab/uid2-shared-actions/actions/shared_publish_setup@v2 - with: - release_type: ${{ inputs.release_type }} - - - name: Set version number - id: version - uses: IABTechLab/uid2-shared-actions/actions/version_number@v2 - with: - type: ${{ inputs.release_type }} - version_number: ${{ inputs.version_number_input }} - branch_name: ${{ github.ref }} - - - name: Update package.json - id: updatePackageJson - run: | - current_version=$(jq -r '.version') - new_version=${{ steps.version.outputs.new_version }} - jq --arg v "$new_version" ".version = \$v" "package.json" > tmp.json && mv tmp.json "package.json" - echo "Version number updated from $current_version to $new_version" - echo "image_tag=${{ steps.version.outputs.new_version }}" >> $GITHUB_OUTPUT - - - name: Commit package.json - if: ${{ inputs.version_number_input == '' && steps.checkRelease.outputs.IS_RELEASE != 'true' }} - uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main - with: - add: 'package.json' - message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}' - - - name: Commit package.json and set tag - if: ${{ inputs.version_number_input == '' && steps.checkRelease.outputs.IS_RELEASE == 'true' }} - uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main - with: - add: 'package.json' - message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}' - tag: v${{ steps.version.outputs.new_version }} + uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-bump-version.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned + with: + release_type: ${{ inputs.release_type }} + secrets: inherit publishToUID2: uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned From 32a601379a03a4f0fc228527bdd65c5e2b3eeb43 Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Mon, 22 Jan 2024 14:08:23 +1100 Subject: [PATCH 3/5] Remove unnecessary workflow --- .../workflows/release-docker-image-euid.yaml | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/release-docker-image-euid.yaml diff --git a/.github/workflows/release-docker-image-euid.yaml b/.github/workflows/release-docker-image-euid.yaml deleted file mode 100644 index 94c06aa..0000000 --- a/.github/workflows/release-docker-image-euid.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Release EUID TCPORTAL Image -run-name: ${{ inputs.release_type == 'Snapshot' && 'Publish Pre-release' || format('Release {0}', inputs.release_type)}} EUID Docker Image by @${{ github.actor }} -on: - workflow_dispatch: - inputs: - release_type: - type: choice - description: 'The type of release' - options: - - Major - - Minor - - Patch - - Snapshot - -jobs: - Image: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v2 - with: - release_type: ${{ inputs.release_type }} - docker_file: Dockerfile_euid - docker_image_name: iabtechlab/euid-tcportal - docker_registry: ghcr.io - secrets: inherit From c978c9af71baa7b81455260d901a4555feb656ed Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Mon, 22 Jan 2024 14:20:31 +1100 Subject: [PATCH 4/5] Rename workflow to incrementVersionNumber --- .github/workflows/release-docker-image.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-docker-image.yaml b/.github/workflows/release-docker-image.yaml index cc66c98..a74d552 100644 --- a/.github/workflows/release-docker-image.yaml +++ b/.github/workflows/release-docker-image.yaml @@ -14,18 +14,18 @@ on: pull_request: jobs: - bumpVersion: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-bump-version.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned + incrementVersionNumber: + uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned with: release_type: ${{ inputs.release_type }} secrets: inherit publishToUID2: uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned - needs: bumpVersion + needs: incrementVersionNumber with: - new_version: ${{ needs.bumpVersion.outputs.new_version }} - image_tag: ${{ needs.bumpVersion.outputs.image_tag }} + new_version: ${{ needs.incrementVersionNumber.outputs.new_version }} + image_tag: ${{ needs.incrementVersionNumber.outputs.image_tag }} release_type: ${{ inputs.release_type }} docker_file: Dockerfile_uid2 docker_image_name: iabtechlab/uid2-tcportal @@ -34,10 +34,10 @@ jobs: publishToEUID: uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned - needs: bumpVersion + needs: incrementVersionNumber with: - new_version: ${{ needs.bumpVersion.outputs.new_version }} - image_tag: ${{ needs.bumpVersion.outputs.image_tag }} + new_version: ${{ needs.incrementVersionNumber.outputs.new_version }} + image_tag: ${{ needs.incrementVersionNumber.outputs.image_tag }} release_type: ${{ inputs.release_type }} docker_file: Dockerfile_euid docker_image_name: iabtechlab/euid-tcportal From fc97fabf02f5a96cd66db4236d073f534c402cf3 Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Mon, 22 Jan 2024 14:27:15 +1100 Subject: [PATCH 5/5] Use v2 for shared actions --- .github/workflows/release-docker-image.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-docker-image.yaml b/.github/workflows/release-docker-image.yaml index a74d552..2074010 100644 --- a/.github/workflows/release-docker-image.yaml +++ b/.github/workflows/release-docker-image.yaml @@ -15,13 +15,13 @@ on: jobs: incrementVersionNumber: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned + uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v2 with: release_type: ${{ inputs.release_type }} secrets: inherit publishToUID2: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned + uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v2 needs: incrementVersionNumber with: new_version: ${{ needs.incrementVersionNumber.outputs.new_version }} @@ -33,7 +33,7 @@ jobs: secrets: inherit publishToEUID: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@kcc-UID2-2674-implement-shared-publish-to-docker-versioned + uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v2 needs: incrementVersionNumber with: new_version: ${{ needs.incrementVersionNumber.outputs.new_version }}