-
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.
- Loading branch information
Showing
10 changed files
with
592 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 @@ | ||
_workflows/* |
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,21 @@ | ||
# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action | ||
name: 'Calculate Release Hash' | ||
description: 'Calculate deps and os hash' | ||
inputs: | ||
files: | ||
description: 'Files to use to calculate the hash' | ||
required: true | ||
default: "pdm.lock docker/bin/* docker/conf/* docker/Dockerfile" | ||
outputs: | ||
hash: # id of output | ||
description: 'The time we greeted you' | ||
value: ${{ steps.calc.outputs.hash }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- id: calc | ||
shell: bash --noprofile --norc -eo pipefail -ux {0} | ||
run: | | ||
LOCK_SHA=$(sha1sum ${{ inputs.files }} | sha1sum | awk '{print $1}' | cut -c 1-8) | ||
echo "hash=$LOCK_SHA" >> "$GITHUB_OUTPUT" |
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,54 @@ | ||
# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action | ||
name: 'Calculate version hash' | ||
description: 'Calculate deps and os hash' | ||
inputs: | ||
username: | ||
description: '' | ||
required: true | ||
password: | ||
description: '' | ||
required: true | ||
image: | ||
description: '' | ||
required: true | ||
target: | ||
description: '' | ||
required: true | ||
|
||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
tags: ${{vars.DOCKER_IMAGE}}:dev-latest | ||
file: ./docker/Dockerfile | ||
platforms: linux/amd64 | ||
cache-from: type=registry,ref=${{vars.DOCKER_IMAGE}}:dev-latest | ||
cache-to: type=inline | ||
outputs: type=registry | ||
target: python_dev_deps | ||
build-args: | | ||
BUILD_DATE="${{ steps.build_date.outputs.date }}" | ||
CHECKSUM="${{ steps.release_hash.outputs.hash }}" | ||
VERSION="${{ steps.version.outputs.version }}" | ||
- name: Calculate Release Hash | ||
id: calc | ||
shell: bash --noprofile --norc -eo pipefail {0} | ||
run: | | ||
docker pull ${{inputs.image}} | ||
echo "----------" | ||
docker inspect --format='{{json .Config.Labels}}' ${{inputs.image}}}}:dev-latest | ||
docker run -t ${{inputs.image}}}}:dev-latest release-info.sh | ||
echo "----------" |
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,34 @@ | ||
# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action | ||
name: 'Retrieve Docker Image Information' | ||
description: 'Calculate deps and os hash' | ||
inputs: | ||
image: | ||
description: 'Files to use to calculate the hash' | ||
required: true | ||
username: | ||
description: '' | ||
required: true | ||
password: | ||
description: '' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
# - name: Configure Git | ||
# shell: bash | ||
# run: git config --global --add safe.directory $(realpath .) | ||
# - name: ch | ||
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- uses: docker/login-action@v3 | ||
with: | ||
username: ${{ inputs.username }} | ||
password: ${{ inputs.password }} | ||
- name: Calculate Release Hash | ||
shell: bash | ||
run: | | ||
docker pull ${{inputs.image}} | ||
echo "----------" | ||
docker inspect --format='{{json .Config.Labels}}' ${{inputs.image}} | ||
docker run -t ${{inputs.image}} release-info.sh | ||
echo "----------" |
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,51 @@ | ||
name: 'version' | ||
description: '' | ||
|
||
outputs: | ||
stage: | ||
description: '' | ||
value: ${{ steps.version.outputs.stage }} | ||
version: | ||
description: '' | ||
value: ${{ steps.version.outputs.version }} | ||
commit: | ||
description: '' | ||
value: ${{ steps.version.outputs.commit }} | ||
release: | ||
description: '' | ||
value: ${{ steps.version.outputs.release }} | ||
date: | ||
description: '' | ||
value: ${{ steps.build_date.outputs.date }} | ||
today: | ||
description: '' | ||
value: ${{ steps.build_date.outputs.today }} | ||
timestamp: | ||
description: '' | ||
value: ${{ steps.build_date.outputs.timestamp }} | ||
branch: | ||
description: '' | ||
value: ${{ steps.extract_branch.outputs.branch }} | ||
|
||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- shell: bash --noprofile --norc -eo pipefail {0} | ||
run: git config --global --add safe.directory $(realpath .) | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- id: version | ||
uses: ./.github/actions/version | ||
- id: extract_branch | ||
name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
- id: build_date | ||
shell: bash --noprofile --norc -eo pipefail -ux {0} | ||
run: | | ||
d1=$(date +"%a,%e %b %Y %H:%M %Z") | ||
d2=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
d3=$(date -u +"%Y%m%d%H%M%S") | ||
echo "today=$d1" >> $GITHUB_OUTPUT | ||
echo "date=$d2" >> $GITHUB_OUTPUT | ||
echo "timestamp=$d3" >> $GITHUB_OUTPUT |
Oops, something went wrong.