Skip to content

Commit

Permalink
build(workflow): update steps, use semver tags
Browse files Browse the repository at this point in the history
  • Loading branch information
manbearwiz committed Jul 30, 2022
1 parent 9eed713 commit 38fc4a3
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,40 @@ name: ci
on:
push:
branches:
- master
- 'master'
tags:
- 'v*'
pull_request:
branches:
- master
- 'master'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: '${{ secrets.DOCKERHUB_USERNAME }}'
password: '${{ secrets.DOCKERHUB_TOKEN }}'
uses: actions/checkout@v3
- name: 'Extract metadata (tags, labels) for Docker'
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: |
kmb32123/youtube-dl-server
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
images: kmb32123/youtube-dl-server
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
push: '${{ github.event_name != ''pull_request'' }}'
tags: '${{ steps.meta.outputs.tags }}'
labels: '${{ steps.meta.outputs.labels }}'
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 38fc4a3

Please sign in to comment.