Refactoring of github actions files #1
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: Build single image | |
on: | |
jobs: | |
generate_docker_image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- id: commit | |
uses: pr-mpt/actions-commit-hash@v1 | |
- name: Extract branch name | |
shell: bash | |
id: extract_branch | |
run: echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/*/} | |
- name: Get current time | |
uses: josStorer/get-current-time@v2 | |
id: current-time | |
with: | |
format: readableTime | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_HUB_LOGIN }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Docker image (amd) | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
id: build_amd | |
with: | |
context: ${{ github.workspace }} | |
file: dockerfile_amd | |
platforms: linux/amd64 | |
push: true | |
tags: totonyus/ydl_api_ng:${{ env.TAG_START }}amd | |
build-args: | | |
GIT_BRANCH=${{ steps.extract_branch.outputs.BRANCH_NAME }} | |
GIT_REVISION=${{ steps.commit.outputs.hash }} | |
DATE=${{ steps.current-time.outputs.time }} | |
- name: Build and push Docker image (arm) | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
id: build_arm | |
with: | |
context: ${{ github.workspace }} | |
file: dockerfile_arm | |
platforms: linux/arm/v7,linux/arm64/v8 | |
push: true | |
tags: totonyus/ydl_api_ng:${{ env.TAG_START }}arm | |
build-args: | | |
GIT_BRANCH=${{ steps.extract_branch.outputs.BRANCH_NAME }} | |
GIT_REVISION=${{ steps.commit.outputs.hash }} | |
DATE=${{ steps.current-time.outputs.time }} | |
- uses: int128/docker-manifest-create-action@v2 | |
with: | |
tags: ${{ env.TAGS }} | |
sources: | | |
totonyus/ydl_api_ng@${{ steps.build_amd.outputs.digest }} | |
totonyus/ydl_api_ng@${{ steps.build_arm.outputs.digest }} | |
- name: Docker Hub Description | |
uses: peter-evans/[email protected] | |
if: ${{ env.UPDATE_DOCKER_HUB_DESCRIPTION == 'true' }} | |
with: | |
username: ${{ secrets.DOCKER_HUB_LOGIN }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
repository: totonyus/ydl_api_ng | |
readme-filepath: ${{ github.workspace }}/readme.md |