chore: template setup #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
name: "Build and Push Image" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Short Commit Hash | |
id: vars | |
shell: bash | |
run: | | |
echo "VERSION=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | |
echo Build Version: $VERSION | |
- name: Build Image | |
run: | | |
docker build -t app:${{ github.sha }} \ | |
--build-arg VERSION=${{ github.sha }} \ | |
. | |
# NOTE: The last two steps is only for template purposes. You should be pushing the image to an image registry/repository. | |
# When you use this template, make sure to replace this step with the appropriate step to push the image to your | |
# image registry/repository. | |
- name: Save Docker Image as tarball | |
run: | | |
docker save app:${{ github.sha }} -o app_${{ github.sha }}.tar | |
- name: Upload Docker Image Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app_${{ github.sha }} | |
path: app_${{ github.sha }}.tar |