Skip to content

Commit

Permalink
Improve GitHub actions
Browse files Browse the repository at this point in the history
Add tags and labels when new Docker images are published
Test build Docker image on push and pull request
Release image on GitHub Docker registry
  • Loading branch information
NeverMendel committed Oct 2, 2021
1 parent d960b4d commit 4339b2e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 49 deletions.
9 changes: 0 additions & 9 deletions .dockerignore

This file was deleted.

8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
31 changes: 0 additions & 31 deletions .github/workflows/publish-docker-image-on-release.yml

This file was deleted.

40 changes: 31 additions & 9 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,48 @@ name: Publish Docker Image
on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
- 'latest'
- 'develop'
tags:
- 'v*'

jobs:
docker:
publish-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/#-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push

- name: Log in GitHub Docker registry
uses: docker/#-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
nevermendel/docker-xelatex-awesome-cv
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: nevermendel/docker-xelatex-awesome-cv:latest
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
22 changes: 22 additions & 0 deletions .github/workflows/test-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test Build Docker Image

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
test-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
push: false

0 comments on commit 4339b2e

Please # to comment.