⚙️ .github: use docker's actions

master
neingeist 2 years ago
parent 66e0ff5cf1
commit b9cf9cd94f

@ -4,7 +4,6 @@ on: [push, workflow_dispatch]
env: env:
ENDPOINT: "neingeist/docker-mod-terminfos" ENDPOINT: "neingeist/docker-mod-terminfos"
BRANCH: "master"
jobs: jobs:
build: build:
@ -12,34 +11,34 @@ jobs:
permissions: permissions:
packages: write packages: write
steps: steps:
- uses: actions/checkout@v3 - name: Checkout
uses: actions/checkout@v3
- name: Docker meta -
name: Docker - Meta
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: ghcr.io/neingeist/docker-mod-terminfos images: ghcr.io/{{ ENDPOINT }}
tags: | tags: |
type=ref,event=branch type=ref,event=branch
# set latest tag for default branch # set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}} type=raw,value=latest,enable={{is_default_branch}}
-
- name: Build image name: Docker - Set up Docker Buildx
run: | uses: docker/setup-buildx-action@v2
docker build --no-cache -t ${{ github.sha }} . -
- name: Tag image name: Docker - Login to GitHub Container Registry
if: ${{ github.ref == format('refs/heads/{0}', env.BRANCH) && env.ENDPOINT != 'user/endpoint' }} if: github.ref_type == 'branch'
run: | uses: docker/login-action@v2
docker tag ${{ github.sha }} ${ENDPOINT} with:
docker tag ${{ github.sha }} ${ENDPOINT}:${{ github.sha }} registry: ghcr.io
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT} username: ${{ github.actor }}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${{ github.sha }} password: ${{ secrets.GITHUB_TOKEN }
- name: Login to GitHub Container Registry -
if: ${{ github.ref == format('refs/heads/{0}', env.BRANCH) && env.ENDPOINT != 'user/endpoint' }} name: Docker - Build and push
run: | uses: docker/build-push-action@v3
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin with:
- name: Push tags to GitHub Container Registry push: ${{ github.ref_type == 'branch' }}
if: ${{ github.ref == format('refs/heads/{0}', env.BRANCH) && env.ENDPOINT != 'user/endpoint' }} tags: ${{ steps.meta.outputs.tags }}
run: | labels: ${{ steps.meta.outputs.labels }}
docker push ghcr.io/${ENDPOINT}:${{ github.sha }}
docker push ghcr.io/${ENDPOINT}

Loading…
Cancel
Save