-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Manual Build for Dev or Feature Branches | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Branch to build the Docker image from' | ||
required: true | ||
default: 'dev' | ||
|
||
jobs: | ||
manual-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the specified branch | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.branch }} | ||
- name: Extract Version | ||
id: extract_version | ||
run: | | ||
version=$(python3 -c "import version; print(f'{version.__version__}')") | ||
echo "VERSION=$version" >> $GITHUB_ENV | ||
# Extract branch name and latest commit SHA | ||
- name: Extract branch name and commit SHA | ||
id: branch_info | ||
run: | | ||
echo "BRANCH_NAME=${{ github.event.inputs.branch }}" >> $GITHUB_ENV | ||
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
# Create a file indicating this is a dev build | ||
- name: Create DEV_BUILD file | ||
run: | | ||
echo "${{ env.BRANCH_NAME }}-${{ env.COMMIT_SHA }}" > DEV_BUILD | ||
# Set up Docker | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Log in to GHCR | ||
- name: Log in to GHCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Build and push Docker image to GHCR | ||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
ghcr.io/${{ github.repository }}:dev | ||