2024-02-19 01:32:57 +00:00
|
|
|
name: Container & Helm chart
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
2024-02-27 23:30:10 +00:00
|
|
|
semrel_dryrun:
|
|
|
|
name: Semantic Release (Dry-run)
|
2024-02-27 22:35:23 +00:00
|
|
|
runs-on: dind-rootless
|
2024-02-27 23:30:10 +00:00
|
|
|
outputs:
|
|
|
|
version: ${{ steps.sem_rel.outputs.version }}
|
2024-02-27 22:35:23 +00:00
|
|
|
steps:
|
2024-02-27 22:47:53 +00:00
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v3
|
2024-02-19 09:40:58 +00:00
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v3
|
2024-02-19 09:30:18 +00:00
|
|
|
with:
|
2024-02-19 09:40:58 +00:00
|
|
|
node-version: 20
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
npm install \
|
|
|
|
semantic-release \
|
|
|
|
@semantic-release/commit-analyzer \
|
|
|
|
@semantic-release/exec
|
|
|
|
- name: Semantic Release (dry-run)
|
2024-02-27 22:18:49 +00:00
|
|
|
id: sem_rel
|
2024-02-19 09:40:58 +00:00
|
|
|
run: |
|
|
|
|
npx semantic-release \
|
|
|
|
--package @semantic-release/exec \
|
|
|
|
--package semantic-release \
|
|
|
|
--branches ${{ gitea.refname }} \
|
2024-02-19 09:50:31 +00:00
|
|
|
--tag-format 'v${version}' \
|
2024-02-19 09:40:58 +00:00
|
|
|
--dry-run \
|
|
|
|
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
|
|
|
--analyzeCommits @semantic-release/commit-analyzer \
|
|
|
|
--verifyRelease @semantic-release/exec \
|
2024-02-27 23:16:40 +00:00
|
|
|
--verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
|
2024-02-19 01:57:46 +00:00
|
|
|
env:
|
2024-02-28 06:39:47 +00:00
|
|
|
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|
2024-02-27 22:18:49 +00:00
|
|
|
- name: Assert semantic release output
|
|
|
|
run: |
|
2024-02-27 23:00:38 +00:00
|
|
|
[[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
|
|
|
|
echo 'No release tag - exiting'; exit 1
|
|
|
|
} || {
|
|
|
|
echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0
|
|
|
|
}
|
2024-02-19 02:09:58 +00:00
|
|
|
|
2024-02-27 23:30:10 +00:00
|
|
|
build_container:
|
|
|
|
name: Container image
|
2024-02-20 01:23:40 +00:00
|
|
|
container: catthehacker/ubuntu:act-latest
|
2024-02-20 23:43:23 +00:00
|
|
|
runs-on: dind
|
2024-02-27 23:30:10 +00:00
|
|
|
needs: semrel_dryrun
|
2024-02-19 10:02:23 +00:00
|
|
|
steps:
|
2024-02-27 22:47:53 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
2024-02-27 22:23:21 +00:00
|
|
|
- name: Kaniko build
|
|
|
|
uses: aevea/action-kaniko@master
|
|
|
|
with:
|
|
|
|
registry: code.spamasaurus.com
|
|
|
|
image: djpbessems/spamasaurusrex
|
|
|
|
username: ${{ secrets.GIT_USERNAME }}
|
|
|
|
password: ${{ secrets.GIT_APIKEY }}
|
2024-02-27 23:30:10 +00:00
|
|
|
tag: ${{ needs.semrel_dryrun.outputs.version }}
|
2024-02-27 22:18:49 +00:00
|
|
|
|
2024-02-27 23:30:10 +00:00
|
|
|
build_chart:
|
|
|
|
name: Helm chart
|
2024-02-27 22:18:49 +00:00
|
|
|
runs-on: dind-rootless
|
2024-02-27 23:30:10 +00:00
|
|
|
needs: semrel_dryrun
|
2024-02-27 22:18:49 +00:00
|
|
|
steps:
|
2024-02-27 22:47:53 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
2024-02-27 22:18:49 +00:00
|
|
|
- name: Inject semantic release version
|
|
|
|
run: |
|
2024-02-27 23:30:10 +00:00
|
|
|
sed -i 's/{{ chart_version }}/'${{ needs.semrel_dryrun.outputs.version }}'/g' charts/spamasaurusrex/Chart.yaml
|
|
|
|
sed -i 's/{{ image_tag }}/'${{ needs.semrel_dryrun.outputs.version }}'/g' charts/spamasaurusrex/values.yaml
|
2024-02-27 22:47:53 +00:00
|
|
|
- name: Install helm w/ plugins
|
|
|
|
run: |
|
2024-02-27 22:51:11 +00:00
|
|
|
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null
|
2024-02-27 23:01:58 +00:00
|
|
|
apt-get install apt-transport-https --yes
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list
|
|
|
|
apt-get update && apt-get install helm --yes
|
2024-02-27 22:47:53 +00:00
|
|
|
helm plugin install https://github.com/chartmuseum/helm-push
|
2024-02-27 22:18:49 +00:00
|
|
|
- name: Package helm chart into archive
|
|
|
|
run: |
|
|
|
|
helm package ./charts/spamasaurusrex
|
2024-02-28 06:20:55 +00:00
|
|
|
- name: Add target helm repository
|
|
|
|
run: |
|
|
|
|
helm repo add \
|
2024-02-28 06:30:21 +00:00
|
|
|
--username ${{ secrets.GIT_USERNAME }} \
|
|
|
|
--password ${{ secrets.GIT_APIKEY }} \
|
2024-02-28 06:20:55 +00:00
|
|
|
spamasaurus \
|
2024-02-28 06:30:21 +00:00
|
|
|
https://code.spamasaurus.com/api/packages/${{ secrets.GIT_USERNAME }}/helm
|
2024-02-27 22:18:49 +00:00
|
|
|
- name: Push helm chart
|
|
|
|
run: |
|
|
|
|
helm cm-push \
|
|
|
|
spamasaurusrex-*.tgz \
|
2024-02-28 06:20:55 +00:00
|
|
|
spamasaurus
|
2024-02-28 06:39:47 +00:00
|
|
|
|
|
|
|
semrel:
|
|
|
|
name: Semantic Release
|
|
|
|
runs-on: dind-rootless
|
|
|
|
needs: build_container,build_chart
|
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 20
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
npm install \
|
|
|
|
semantic-release \
|
|
|
|
@semantic-release/commit-analyzer \
|
|
|
|
@semantic-release/exec
|
|
|
|
- name: Semantic Release
|
|
|
|
run: |
|
|
|
|
npx semantic-release \
|
|
|
|
--branches ${{ gitea.refname }} \
|
|
|
|
--tag-format "v\$${version}" \
|
|
|
|
--plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/changelog,@semantic-release/git
|
|
|
|
env:
|
|
|
|
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|