Skip to content

Use actor

Use actor #1

name: Build and Deploy
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`)
- name: Lowercase repository name
id: repository_name
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ steps.repository_name.outputs.lowercase }}:latest
ghcr.io/${{ steps.repository_name.outputs.lowercase }}:${{ steps.get_version.outputs.VERSION }}
secrets: |
GIT_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}