1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 13:19:02 +08:00

fix: GitHub Actions docker

This commit is contained in:
zu1k 2021-10-26 13:49:14 +08:00
parent e4b0253ec6
commit cd1def5169

View File

@ -2,20 +2,36 @@ name: docker
on: [push, pull_request] on: [push, pull_request]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build: build:
name: Build name: Build
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps: steps:
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v2.3.5 uses: actions/checkout@v2.3.5
- name: Log in to the Container registry
- name: Build and push Docker images uses: docker/login-action@latest
uses: docker/build-push-action@v2.7.0
with: with:
username: zu1k registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com - name: Extract metadata (tags, labels) for Docker
repository: zu1k/nali/nali id: meta
tag_with_ref: true uses: docker/metadata-action@latest
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@2.7.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}