Skip to content

Commit 477baf5

Browse files
authored
Merge pull request #24 from natrontech/ci/improvements
ci: improve release action
2 parents be4604a + 0e57d50 commit 477baf5

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.github/workflows/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
Following workflows are implemented in the repository.
66
[SARIF](https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning) is used to store the results for an analysis of code scanning tools in the Security tab of the repository.
77

8-
| Workflow | Jobs | Trigger | SARIF upload | Description |
9-
| :------------------------------- | :------------------------------ | :------------------------------------------------------------ | :----------- | ------------------------------------------------------------------------ |
10-
| [release.yml](./release.yml) | see [release chapter](#release) | push tag `v*`, cron `20 14 * * *`, pr on `main` | - | Create release with go binaries and docker container |
11-
| [scorecard.yml](./scorecard.yml) | `analyze` | push to `main`, cron: `00 14 * * 1`, change branch protection | yes | Create OpenSSF analysis and create project score |
8+
| Workflow | Jobs | Trigger | SARIF upload | Description |
9+
| :------------------------------- | :------------------------------ | :------------------------------------------------------------ | :----------- | ---------------------------------------------------- |
10+
| [release.yml](./release.yml) | see [release chapter](#release) | push tag `v*`, cron `20 10 * * *`, pr on `main` | - | Create release with go binaries and docker container |
11+
| [scorecard.yml](./scorecard.yml) | `analyze` | push to `main`, cron: `00 14 * * 1`, change branch protection | yes | Create OpenSSF analysis and create project score |
1212

1313
## Release
1414

.github/workflows/release.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
name: release
22

33
on:
4-
workflow_dispatch:
54
schedule:
6-
- cron: '20 14 * * *'
5+
- cron: '20 10 * * *'
76
push:
87
tags:
98
- "v*"
9+
## uncomment if you want to release on PR merge
10+
# pull_request:
11+
# branches:
12+
# - main
13+
1014

1115
concurrency:
1216
group: ${{ github.workflow }}-${{ github.ref }}
@@ -44,6 +48,16 @@ jobs:
4448
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
4549
with:
4650
images: ghcr.io/${{ github.repository }}
51+
tags: |
52+
# If triggered by a schedule on main -> Tag as latest
53+
type=raw,value=latest,enable={{ github.event_name == 'schedule' && github.ref_name == 'main' }}
54+
55+
# If tag push (e.g., v1.2.3) -> Create both versioned tag and latest
56+
type=ref,event=tag
57+
type=raw,value=latest,enable={{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
58+
59+
# If pull request event
60+
type=ref,event=pr
4761
- name: Build and push Docker image
4862
id: build-and-push
4963
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6.14.0

0 commit comments

Comments
 (0)