Bump version to 1.3.0 (#518) #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: read-all | |
jobs: | |
build-and-publish-images: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to AWS Public ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: public.ecr.aws | |
username: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Extract tag name | |
id: extract_tag_name | |
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Build and push gitvote-dbmigrator image | |
run: | | |
docker build \ | |
-f database/migrations/Dockerfile \ | |
-t public.ecr.aws/g6m3a0y9/gitvote-dbmigrator:${{steps.extract_tag_name.outputs.tag}} \ | |
-t public.ecr.aws/g6m3a0y9/gitvote-dbmigrator:latest \ | |
. | |
docker push --all-tags public.ecr.aws/g6m3a0y9/gitvote-dbmigrator | |
- name: Build and push gitvote image | |
run: | | |
docker build \ | |
-t public.ecr.aws/g6m3a0y9/gitvote:${{steps.extract_tag_name.outputs.tag}} \ | |
-t public.ecr.aws/g6m3a0y9/gitvote:latest \ | |
. | |
docker push --all-tags public.ecr.aws/g6m3a0y9/gitvote | |
package-and-publish-helm-chart: | |
needs: | |
- build-and-publish-images | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
- name: Run chart-releaser | |
run: | | |
# From: https://github.com/metallb/metallb/blob/293f43c1f78ab1b5fa8879a76746b094bd9dd3ca/.github/workflows/publish.yaml#L134-L163 | |
# Ref: https://github.com/helm/chart-releaser-action/issues/60 | |
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v1.5.0/chart-releaser_1.5.0_linux_amd64.tar.gz" | |
tar -xzf cr.tar.gz | |
rm -f cr.tar.gz | |
repo=$(basename "$GITHUB_REPOSITORY") | |
owner=$(dirname "$GITHUB_REPOSITORY") | |
tag="${GITHUB_REF_NAME:1}" | |
exists=$(curl -s -H "Accept: application/vnd.github.v3+json" https://github.com/$GITHUB_REPOSITORY/releases/tag/$repo-chart-$tag -w %{http_code} -o /dev/null) | |
if [[ $exists != "200" ]]; then | |
echo "Creating release..." | |
# package chart | |
./cr package charts/$repo | |
# upload chart to github releases | |
./cr upload \ | |
--owner "$owner" \ | |
--git-repo "$repo" \ | |
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \ | |
--token "${{ secrets.GITHUB_TOKEN }}" | |
# Update index and push to github pages | |
./cr index \ | |
--owner "$owner" \ | |
--git-repo "$repo" \ | |
--index-path index.yaml \ | |
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \ | |
--push | |
else | |
echo "Release already exists" | |
fi |