-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
7a36fb6
commit c5f0ba5
Showing
1 changed file
with
48 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,48 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract tag | ||
id: extract_tag | ||
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Verify SemVer format | ||
id: semver_check | ||
run: | | ||
if [[ ! "${TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Error: Tag ${TAG} is not in semver format X.X.X" | ||
exit 1 | ||
fi | ||
- name: Build Docker image | ||
run: | | ||
sudo docker buildx build -t github_jira_sync_app --output type=docker . | ||
- name: Tag Docker image | ||
run: | | ||
sudo docker tag github_jira_sync_app ghcr.io/canonical/gh-jira-sync-bot:${TAG} | ||
- name: Push Docker image | ||
run: | | ||
sudo docker push ghcr.io/canonical/gh-jira-sync-bot:${TAG} |