Skip to content

Commit

Permalink
[ACS-4535] rework docker publishing actions (#3068)
Browse files Browse the repository at this point in the history
* rework docker publishing actions

* simplify steps

* rollback AWS credentials
  • Loading branch information
DenysVuika authored Mar 16, 2023
1 parent f21299a commit 36c5c39
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/actions/download-job-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
using: "composite"
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
Expand Down
21 changes: 21 additions & 0 deletions .github/actions/get-image-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Get Image Tag"
description: "Generates a tag for Docker image"

inputs:
branch_name:
description: 'Name of the branch the workflow runs on'
required: true
type: string

runs:
using: "composite"
steps:
- name: Get docker image tag name
shell: bash
run: |
if [[ "${{ inputs.branch_name }}" == "master" ]]; then
TAG_VERSION="$(jq -cr '.version' < package.json)"
else
TAG_VERSION="${{ inputs.branch_name }}-${{ github.run_id }},{{ inputs.branch_name }}"
fi
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
38 changes: 25 additions & 13 deletions .github/actions/publish-image/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Publish Docker Images"
description: "Publish Docker image to quay.io or dockerhub or another domain - only publish the version on master - elsewhere version and branch"
description: "Publish Docker Image to the provided registry"

inputs:
domain:
description: 'domain to publish image to'
registry:
description: 'Docker registry'
required: true
type: string
username:
Expand All @@ -26,15 +26,27 @@ inputs:
runs:
using: "composite"
steps:
- name: Get docker image tag name
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Get Tag
uses: ./.github/actions/get-image-tag
with:
branch_name: ${{ inputs.branch_name }}

- name: Publish
if: ${{ github.event.inputs.dry-run != 'true' }}
shell: bash
run: |
if [[ "${{ inputs.branch_name }}" == "master" ]]; then
TAG_VERSION=$(jq -cr '.version' < package.json)
else
TAG_VERSION=${{ inputs.branch_name }}-${{ github.run_id }}
fi
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
- name: Publish image
shell: bash
run: ./scripts/gh/docker-publish.sh "${{ inputs.domain }}" "$REPO_SLUG" "${{ inputs.username }}" "${{ inputs.password }}" "$TAG_VERSION" "${{ inputs.branch_name }}" "${{ inputs.dry-run }}"
npm ci && npm run build.release
echo "Running the docker with tag $TAG_VERSION"
npx @alfresco/adf-cli docker-publish \
--dockerRepo "${{ inputs.registry }}/alfresco/alfresco-content-app" \
--buildArgs "PROJECT_NAME=content-ce" \
--dockerTags "$TAG_VERSION" \
--pathProject "$(pwd)"
2 changes: 1 addition & 1 deletion .github/actions/upload-job-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
using: "composite"
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ env:
APP_CONFIG_OAUTH2_REDIRECT_LOGOUT: /
APP_CONFIG_OAUTH2_REDIRECT_LOGIN: /
APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI: "{protocol}//{hostname}{:port}/assets/silent-refresh.html"
REPO_SLUG: "alfresco/alfresco-content-app"
NPM_REGISTRY_ADDRESS: ${{ secrets.NPM_REGISTRY_ADDRESS }}


Expand All @@ -57,7 +56,7 @@ jobs:
uses: ./.github/actions/publish-image
with:
branch_name: ${{ env.BRANCH_NAME }}
domain: quay.io
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
dry-run: ${{ inputs.dry-run-release }}
Expand All @@ -80,7 +79,7 @@ jobs:
uses: ./.github/actions/publish-image
with:
branch_name: ${{ env.BRANCH_NAME }}
domain: docker.io
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dry-run: ${{ inputs.dry-run-release }}
Expand Down
26 changes: 0 additions & 26 deletions scripts/gh/docker-publish.sh

This file was deleted.

0 comments on commit 36c5c39

Please sign in to comment.