Docker Community #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Community | |
on: | |
workflow_run: | |
workflows: [Release NPM] | |
types: | |
- completed | |
push: | |
branches: | |
- 'release/**' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set Current Version | |
run: | | |
STEEDOS_VERSION=$(node -p 'require("./lerna.json").version') | |
echo "STEEDOS_VERSION=${STEEDOS_VERSION}" >> $GITHUB_ENV | |
echo "STEEDOS_VERSION=${STEEDOS_VERSION}" | |
- name: Generate info.json | |
run: | | |
if [[ -f deploy/enterprise/scripts/generate_info_json.sh ]]; then | |
deploy/enterprise/scripts/generate_info_json.sh | |
fi | |
- uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
with: | |
driver-opts: network=host | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
steedos/steedos-community | |
252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn/dockerhub/steedos/steedos-community | |
tags: | | |
type=semver,pattern={{version}},value=${{ env.STEEDOS_VERSION }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ env.STEEDOS_VERSION }} | |
type=semver,pattern={{major}},value=${{ env.STEEDOS_VERSION }} | |
- uses: docker/login-action@v1 | |
name: Login Docker Hub | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_NINGXIA }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_NINGXIA }} | |
aws-region: cn-northwest-1 | |
- | |
name: Login to ECR | |
uses: docker/login-action@v2 | |
with: | |
registry: 252208178451.dkr.ecr.cn-northwest-1.amazonaws.com.cn | |
- name: Replace Version ~2.5 to Tag | |
uses: jacobtomlinson/gha-find-replace@v2 | |
with: | |
include: deploy/docker/app/platform/package.json | |
find: "~2.5" | |
replace: ${{env.STEEDOS_VERSION}} | |
regex: false | |
- name: Build and push docker | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./deploy/docker | |
platforms: linux/amd64 #,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |