7f43d0c69d
Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
95 lines
2.5 KiB
YAML
95 lines
2.5 KiB
YAML
name: Reusable Publish Docker Image Workflow
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
service_name:
|
|
required: true
|
|
type: string
|
|
package_path:
|
|
required: true
|
|
type: string
|
|
workspace_name:
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
DOCKER_USERNAME:
|
|
required: true
|
|
DOCKER_PASSWORD:
|
|
required: true
|
|
AWS_ACCESS_KEY_ID:
|
|
required: true
|
|
AWS_SECRET_ACCESS_KEY:
|
|
required: true
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Cache build
|
|
id: cache-build
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
packages/**/dist
|
|
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
registry-url: 'https://registry.npmjs.org'
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --immutable
|
|
|
|
- name: Build
|
|
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
run: yarn build
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@v3
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws-region: us-east-1
|
|
|
|
- name: Login to Amazon ECR
|
|
id: login-ecr
|
|
uses: aws-actions/amazon-ecr-login@v2
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@master
|
|
with:
|
|
platforms: all
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@master
|
|
|
|
- name: Publish Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: .
|
|
file: ${{ inputs.package_path }}/Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
standardnotes/${{ inputs.service_name }}:latest
|
|
standardnotes/${{ inputs.service_name }}:${{ github.sha }}
|
|
${{ steps.login-ecr.outputs.registry }}/${{ inputs.service_name }}:${{ github.sha }}
|
|
${{ steps.login-ecr.outputs.registry }}/${{ inputs.service_name }}:latest
|