ContainerImage.SpamasaurusRex/.gitea/workflows/actions.yaml

99 lines
3.6 KiB
YAML
Raw Normal View History

2024-02-19 01:32:57 +00:00
name: Container & Helm chart
on: [push]
jobs:
semrel_dryrun:
name: Semantic Release (Dry-run)
2024-02-27 22:35:23 +00:00
runs-on: dind-rootless
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
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 }} \
--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 \
--verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
env:
GIT_CREDENTIALS: djpbessems:${{ 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
}
build_container:
name: Container image
container: catthehacker/ubuntu:act-latest
runs-on: dind
needs: semrel_dryrun
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 }}
tag: ${{ needs.semrel_dryrun.outputs.version }}
2024-02-27 22:18:49 +00:00
build_chart:
name: Helm chart
2024-02-27 22:18:49 +00:00
runs-on: dind-rootless
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: |
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
# - name: Add target helm repository
# run: |
# helm repo add \
# --username $GIT_USERNAME \
# --password $GIT_APIKEY \
# spamasaurus \
# https://code.spamasaurus.com/api/packages/$GIT_USERNAME/helm
2024-02-27 22:18:49 +00:00
- name: Push helm chart
run: |
helm cm-push \
--username $GIT_USERNAME \
--password $GIT_APIKEY \
2024-02-27 22:18:49 +00:00
spamasaurusrex-*.tgz \
https://code.spamasaurus.com/api/packages/$GIT_USERNAME/helm