-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
74 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,40 @@ | ||
name: Publish Docker Images | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: [labeled, closed] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
#if: github.event.pull_request.merged == true | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 # This step checks out your repository | ||
|
||
- name: echo a thing or two | ||
run: cat $GITHUB_EVENT_PATH | ||
#echo $(jq -r '.label.name' $GITHUB_EVENT_PATH) | ||
|
||
- name: Check if pushDocker.sh script exists | ||
run: | | ||
if [ -e "$GITHUB_WORKSPACE/pushDocker.sh" ]; then | ||
echo "pushDocker.sh script exists" | ||
else | ||
echo "pushDocker.sh script does not exist" | ||
fi | ||
- name: Check if PR is labeled as "publish docker" | ||
id: check_label | ||
run: echo "publish=$(jq -r '.label.name' $GITHUB_EVENT_PATH | grep -c '^publish docker$')" >> $GITHUB_ENV | ||
|
||
- name: Log in to GitHub Container Registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
|
||
- name: Execute Script | ||
if: ${{ env.publish != '1' }} | ||
run: $GITHUB_WORKSPACE/pushDocker.sh | ||
|
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
health.json | ||
*.jwt | ||
.idea |
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,32 @@ | ||
#!/bin/bash | ||
|
||
# Retrieve version from the file or environment variable | ||
HEALTHCHECK_PROXY_VERSION=$(cat version 2>/dev/null || echo "${HEALTHCHECK_PROXY_VERSION}") | ||
|
||
# Check if version is set | ||
if [ -z "${HEALTHCHECK_PROXY_VERSION}" ]; then | ||
echo "HEALTHCHECK_PROXY_VERSION is not set and auto-detection failed." | ||
exit 1 | ||
fi | ||
|
||
echo "Building healthcheck-proxy version ${HEALTHCHECK_PROXY_VERSION} for amd64/arm64" | ||
|
||
# Create and use buildx builder | ||
docker buildx create --use --name=healthcheck-proxy | ||
|
||
# Authenticate with GitHub Container Registry using the token from GitHub Secrets | ||
echo "${GHCR_TOKEN}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin | ||
|
||
# Build and push the Docker image | ||
docker buildx build --platform linux/amd64,linux/arm64 . \ | ||
--tag "ghcr.io/${GITHUB_REPOSITORY}/healthcheck-proxy:${HEALTHCHECK_PROXY_VERSION}" \ | ||
--tag "ghcr.io/${GITHUB_REPOSITORY}/healthcheck-proxy:latest" \ | ||
--push | ||
|
||
# Check if build and push were successful | ||
if [ $? -eq 0 ]; then | ||
echo "Build and push completed successfully." | ||
else | ||
echo "Build and push failed." | ||
exit 1 | ||
fi |
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 @@ | ||
0.0.1 |