diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index efceb5bd..40503ac1 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -1,4 +1,4 @@
-name: Build, Test and Release
+name: Build, Test, Automerge and Tag
on:
pull_request_target:
@@ -118,7 +118,7 @@ jobs:
id: create-tarfile
working-directory: ./chart-verifier
run: |
- # check if release file only is included in PR
+ # create test tarball for the tests
ve1/bin/tar-file --release="test"
@@ -187,7 +187,7 @@ jobs:
- name: Approve PR
id: approve_pr
if: ${{ steps.check_version_updated.outputs.updated == 'true'}}
- uses: hmarr/auto-approve-action@v2
+ uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -200,21 +200,21 @@ jobs:
MERGE_METHOD: squash
MERGE_LABELS: ""
- - name: Check for PR merge
- if: ${{ steps.check_version_updated.outputs.updated == 'true'}}
+ - name: Get master branch sha
+ id: master_sha
run: |
- ve1/bin/check-auto-merge --api-url=${{ github.event.pull_request._links.self.href }}
+ git fetch
+ export ORIGIN_MASTER_SHA=$(git rev-parse origin/master)
+ echo "origin_master_sha=$ORIGIN_MASTER_SHA" >> $GITHUB_OUTPUT
- - name: Create the the release
- id: create_release
- if: ${{ steps.check_version_updated.outputs.updated == 'true'}}
- uses: softprops/action-gh-release@v1
+ - name: Tag master
+ id: tag_version
+ uses: mathieudutour/github-tag-action@v6.1
with:
- tag_name: ${{ steps.check_version_in_PR.outputs.PR_version }}
- body: ${{ steps.check_version_in_PR.outputs.PR_release_body }}
- files: ${{ steps.check_version_in_PR.outputs.PR_tarball_name }}
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ custom_tag: ${{ steps.check_version_in_PR.outputs.PR_version }}
+ tag_prefix: ""
+ commit_sha: ${{ steps.master_sha.outputs.origin_master_sha }}
- name: Wait for image build to complete
# Quay is configured to automatically build our image. This waits
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 00000000..ada97558
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,56 @@
+name: create release on new tags
+
+on:
+ push:
+ # Publish semver tags as releases.
+ tags: [ '*.*.*' ]
+ # [0-9]+.[0-9]+.[0-9]+
+
+jobs:
+ build-and-push:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Build binary and make tarball
+ id: build_bin
+ run: |
+ make bin
+ tar -zcvf chart-verifier.tgz -C out/ chart-verifier
+ export TARBALL_PATH=$(realpath chart-verifier.tgz)
+ echo "tarball_path=$TARBALL_PATH"
+
+ - name: Print tag to GITHUB_OUTPUT
+ id: get_tag
+ run: |
+ echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
+
+ - name: Set up Python 3.x
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.9'
+
+ - name: Set up Python scripts
+ run: |
+ # set up python requirements and scripts on PR branch
+ python3 -m venv ve1
+ cd scripts && ../ve1/bin/pip3 install -r requirements.txt && cd ..
+ cd scripts && ../ve1/bin/python3 setup.py install && cd ..
+
+ - name: Generate release body
+ id: release_body
+ run: ve1/bin/print-release-body
+
+ - name: Create the the release
+ id: create_release
+ uses: softprops/action-gh-release@v1
+ with:
+ tag_name: ${{ steps.get_tag.outputs.RELEASE_VERSION }}
+ body: ${{ steps.release_body.outputs.PR_release_body }}
+ files: ${{ steps.build_bin.outputs.tarball_path }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
diff --git a/scripts/setup.cfg b/scripts/setup.cfg
index cbe5e61b..bda5932a 100644
--- a/scripts/setup.cfg
+++ b/scripts/setup.cfg
@@ -36,6 +36,7 @@ where = src
[options.entry_points]
console_scripts =
release-checker = release.releasechecker:main
+ print-release-body = release.releasebody:main
check-auto-merge = checkautomerge.checkautomerge:main
build-and-test = buildandtest.buildandtest:main
check-user = owners.checkuser:main
diff --git a/scripts/src/release/releasebody.py b/scripts/src/release/releasebody.py
new file mode 100644
index 00000000..0a9890ae
--- /dev/null
+++ b/scripts/src/release/releasebody.py
@@ -0,0 +1,25 @@
+import sys
+
+sys.path.append('./scripts/src/')
+from release import releasechecker
+from utils import utils
+
+def make_release_body(version, image_name, release_info):
+ body = f"Chart verifier version {version}
Docker Image:
- {image_name}:{version}
"
+ body += "This version includes:
"
+ for info in release_info:
+ if info.startswith("<"):
+ body += info
+ else:
+ body += f"- {info}
"
+
+ print(f"[INFO] Release body: {body}")
+ utils.add_output("PR_release_body",body)
+
+def main():
+ version_info = releasechecker.get_version_info()
+ make_release_body(version_info["version"],version_info["quay-image"],version_info["release-info"])
+ # tarfile = create(args.release)
+ # print(f'[INFO] Verifier tarball created : {tarfile}.')
+ # utils.add_output("tarball_full_name",tarfile)
+
diff --git a/scripts/src/release/releasechecker.py b/scripts/src/release/releasechecker.py
index 488ee9de..a98189eb 100644
--- a/scripts/src/release/releasechecker.py
+++ b/scripts/src/release/releasechecker.py
@@ -31,7 +31,7 @@
import semver
import sys
sys.path.append('./scripts/src/')
-from release import tarfile_asset
+from release import tarfile_asset, releasebody
from utils import utils
VERSION_FILE = 'pkg/chartverifier/version/version_info.json'
@@ -64,18 +64,6 @@ def check_if_only_version_file_is_modified(api_url):
return version_file_found
-def make_release_body(version, image_name, release_info):
- body = f"Chart verifier version {version}
Docker Image:
- {image_name}:{version}
"
- body += "This version includes:
"
- for info in release_info:
- if info.startswith("<"):
- body += info
- else:
- body += f"- {info}
"
-
- print(f"[INFO] Release body: {body}")
- utils.add_output("PR_release_body",body)
-
def get_version_info():
data = {}
with open(VERSION_FILE) as json_file:
@@ -111,7 +99,7 @@ def main():
utils.add_output("PR_release_image",version_info["quay-image"])
utils.add_output("PR_release_info",version_info["release-info"])
utils.add_output("PR_includes_release","true")
- make_release_body(version_info["version"],version_info["quay-image"],version_info["release-info"])
+ releasebody.make_release_body(version_info["version"],version_info["quay-image"],version_info["release-info"])
else:
version_info = get_version_info()
if args.version: