build starter template
This commit is contained in:
parent
ed5ee2f732
commit
a1186ae347
1 changed files with 46 additions and 0 deletions
46
.github/workflows/release-starter-template.yml
vendored
Normal file
46
.github/workflows/release-starter-template.yml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
name: Build and Deploy starter template
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # Trigger on manual workflow_dispatch
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master # Trigger on pushes to master
|
||||||
|
paths:
|
||||||
|
- 'templates/starter/**' # Trigger only if files in this directory change
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Get short commit hash
|
||||||
|
id: vars
|
||||||
|
run: echo "::set-output name=short_sha::$(echo $GITHUB_SHA | cut -c1-7)"
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: |
|
||||||
|
cd ./templates/starter && docker build -t ghcr.io/${{ github.repository_owner }}/starter-template:${{ steps.vars.outputs.short_sha }} .
|
||||||
|
|
||||||
|
- name: Tag as latest Docker image
|
||||||
|
run: |
|
||||||
|
docker tag ghcr.io/${{ github.repository_owner }}/starter-template:${{ steps.vars.outputs.short_sha }} ghcr.io/${{ github.repository_owner }}/starter-template:latest
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||||
|
|
||||||
|
- name: Push Docker image
|
||||||
|
run: |
|
||||||
|
docker push ghcr.io/${{ github.repository_owner }}/starter-template:latest
|
||||||
Loading…
Reference in a new issue