Skip to content

Commit

Permalink
ci: update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
thuongtruong109 committed Jul 21, 2024
1 parent be068af commit 465f1b7
Showing 1 changed file with 39 additions and 7 deletions.
46 changes: 39 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,51 @@
name: Build image
on:

on:
push:
branches:
- main
paths-ignore:
- "!.github/**"
- "!app/**"
- "!client/**"
- "!nginx/**"

jobs:
publish:
runs-on: "ubuntu-20.04"
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v2
- name: Check out the repo
uses: actions/checkout@v4

- name: Login to Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Log in to the registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT }}

- name: Extract metadata
id: api
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/shakemate
ghcr.io/${{ github.repository }}
- name: Build and publish a Docker image for ${{ github.repository }}
uses: macbre/push-to-ghcr@master
- name: Build and push image
uses: docker/build-push-action@v3
with:
image_name: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
labels: ${{ steps.api.outputs.labels }}

0 comments on commit 465f1b7

Please sign in to comment.