Skip to content

Update Release workflow to generate ghcr images#175

Merged
pramodbindal merged 1 commit into
release-v0.1.xfrom
main
May 5, 2025
Merged

Update Release workflow to generate ghcr images#175
pramodbindal merged 1 commit into
release-v0.1.xfrom
main

Conversation

@pramodbindal

Copy link
Copy Markdown
Member

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

Release Notes

Signed-off-by: Pramod Bindal <prbindal@redhat.com>
Comment on lines +9 to +69
runs-on: ubuntu-latest
steps:
- name: checkout the source code
uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: ^1.23

- name: cache go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: ko-build/setup-ko@v0.8

- name: build and push container images
run: ./hack/build.sh
env:
KO_PUSH: "true"
KO_DOCKER_REPO: "ghcr.io/${{ github.repository }}"

- name: generate a build timestamp and sha256sum files
run: |
cd builds
echo `date -u +'%Y%m%d%H%M%S'` > ./build_timestamp.txt
echo `date -u +'%Y-%m-%dT%H:%M:%S%:z'` >> ./build_timestamp.txt
sha256sum *.yaml > ./SHA256SUMS.txt

- name: update release notes and executables
if: startsWith(github.ref, 'refs/tags/') # executes only for new release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
builds/*.yaml
builds/build_timestamp.txt
builds/SHA256SUMS.txt

- name: Update executables for main branch changes
if: startsWith(github.ref, 'refs/heads/main') # executes only for changes in main
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: main-devel
prerelease: true
title: "Development Build - main branch"
files: |
builds/*.yaml
builds/build_timestamp.txt
builds/SHA256SUMS.txt No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
@pramodbindal pramodbindal merged commit d208d06 into release-v0.1.x May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants