Skip to content

Commit

Permalink
test new action script
Browse files Browse the repository at this point in the history
  • Loading branch information
dimassaputra committed Feb 11, 2023
1 parent 242e6b7 commit 3ecd83c
Showing 1 changed file with 17 additions and 36 deletions.
53 changes: 17 additions & 36 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,27 @@
name: Deploy Hello World
name: Deploy Docker

# Run workflow on tags starting with v (eg. v2, v1.2.0)
on:
push:
branches:
- master
tags:
- "v*-hello-world"
pull_request:
branches:
- 'master'
tags:
- v*

jobs:
deploy-docker-hello-world:
Deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/dsapoetra/landing-page
flavor: latest=true
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Login to image repository
if: github.ref_type == 'tag'
uses: docker/login-action@v2
- name: Checkout Code
uses: actions/checkout@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_REGISTRY_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: ${{ github.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true # Will only build if this is not here
tags: |
ghcr.io/${{ github.repository }}:${{ github.ref }}
ghcr.io/${{ github.repository }}:latest

0 comments on commit 3ecd83c

Please sign in to comment.