-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Migration from Concourse to Github Actions (#109)
* First try at building from GHA instead of concourse * Testing from PR before merging * Wrong path * Testing from PR before merging * Fixing triggers after tests * Testing tag workflow * Fixing triggers after tests * Add PR vbump check
1 parent
5d11b8d
commit 9eec9b7
Showing
3 changed files
with
139 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: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
workflow_dispatch: # Enable manual triggering | ||
inputs: | ||
tag: | ||
description: 'Docker image tag' | ||
required: false | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set Docker image tag | ||
id: set_docker_tag | ||
run: echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> $GITHUB_OUTPUT | ||
continue-on-error: true | ||
shell: bash | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/typositoire/concourse-helm3-resource:${{ steps.set_docker_tag.outputs.tag }} | ||
ghcr.io/typositoire/concourse-helm3-resource:latest |
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,74 @@ | ||
name: Check PR | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files_ignore: | | ||
README.md | ||
ci/** | ||
.github/** | ||
- name: List all changed files | ||
id: list_changed_files | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
ALL_MODIFIED_FILES_COUNT: ${{ steps.changed-files.outputs.all_modified_files_count }} | ||
run: | | ||
echo "${ALL_MODIFIED_FILES_COUNT} files" | ||
for file in ${ALL_CHANGED_FILES}; do | ||
echo "$file was changed" | ||
done | ||
echo "msg=Version bump not required." >> $GITHUB_OUTPUT | ||
- name: auto_pass | ||
if: steps.changed-files.outputs.all_modified_files_count == '0' | ||
id: check_if_only_ignored | ||
run: | | ||
exit 0 | ||
- name: Get version from file | ||
if: steps.changed-files.outputs.all_modified_files_count != '0' | ||
id: get_version | ||
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | ||
|
||
- name: 'Get Previous tag' | ||
if: steps.changed-files.outputs.all_modified_files_count != '0' | ||
id: previoustag | ||
uses: "WyriHaximus/[email protected]" | ||
|
||
- name: Checking for version bump | ||
if: steps.changed-files.outputs.all_modified_files_count != '0' | ||
id: check_vbump | ||
run: | | ||
LAST_TAG="${{ steps.previoustag.outputs.tag }}" | ||
NEW_TAG="v${{ steps.get_version.outputs.version }}" | ||
RESULT=$(ci/assets/checksemver.sh ${NEW_TAG} ${LAST_TAG}) | ||
if [ "${RESULT}" == "1" ]; then | ||
echo "msg=Version bump found." >> $GITHUB_OUTPUT | ||
exit 0 | ||
elif [ "${RESULT}" == "0" ]; then | ||
echo "msg=Version bump did not happen. ${LAST_TAG} is the same as ${NEW_TAG}" >> $GITHUB_OUTPUT | ||
exit 1 | ||
else | ||
echo "msg=Version bump did not happen. ${LAST_TAG} is higher than ${NEW_TAG}" >> $GITHUB_OUTPUT | ||
exit 1 | ||
fi | ||
- uses: mshick/[email protected] | ||
if: always() | ||
with: | ||
message: | | ||
${{ steps.list_changed_files.outputs.msg || steps.check_vbump.outputs.msg }} |
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,25 @@ | ||
name: Tag Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: # Enable manual triggering | ||
inputs: | ||
tag: | ||
description: 'Version to tag (without the prefix v)' | ||
required: false | ||
jobs: | ||
tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Get version from file | ||
id: get_version | ||
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | ||
- name: Create tag | ||
id: create_tag | ||
run: | | ||
git tag -a v${{ github.event.inputs.tag || steps.get_version.outputs.version }} -m "Tagging version v${{ github.event.inputs.tag || steps.get_version.outputs.version }}" | ||
git push origin v${{ github.event.inputs.tag || steps.get_version.outputs.version }} |