2022-02-25 16:45:12 +00:00
|
|
|
name: docker release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-05-30 08:24:56 +00:00
|
|
|
inputs:
|
|
|
|
TAG_NAME:
|
|
|
|
description: 'Tag name that the major tag will point to'
|
|
|
|
required: true
|
2022-06-06 15:32:11 +00:00
|
|
|
PRERELEASE:
|
|
|
|
description: 'Whether this is a prerelease'
|
|
|
|
type: boolean
|
2022-06-16 06:00:11 +00:00
|
|
|
required: true
|
2022-05-30 08:24:56 +00:00
|
|
|
|
|
|
|
release:
|
2022-06-06 13:47:59 +00:00
|
|
|
types: [published]
|
2022-02-25 16:45:12 +00:00
|
|
|
|
2022-05-11 17:37:25 +00:00
|
|
|
permissions:
|
|
|
|
packages: write
|
2022-06-20 17:25:14 +00:00
|
|
|
contents: write
|
|
|
|
id-token: write
|
2022-05-11 17:37:25 +00:00
|
|
|
|
2022-05-30 08:24:56 +00:00
|
|
|
env:
|
|
|
|
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
2022-06-16 06:00:11 +00:00
|
|
|
IS_PRERELEASE: ${{ github.event.release.prerelease || github.event.inputs.PRERELEASE }}
|
2022-06-06 13:47:59 +00:00
|
|
|
|
2022-02-25 16:45:12 +00:00
|
|
|
jobs:
|
2022-12-23 17:48:15 +00:00
|
|
|
# This workaround is needed, as it's not possible to reference env.FOOBAR directly at this stage
|
|
|
|
# - for ex. https://github.com/actions/runner/issues/1189
|
|
|
|
release-container-prereq:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
tag: ${{ steps.release-param.outputs.tag }}
|
|
|
|
tag_latest: ${{ steps.release-param.outputs.tag_latest }}
|
|
|
|
steps:
|
|
|
|
- id: release-param
|
|
|
|
run: |
|
|
|
|
# If env.IS_PRERELEASE is true, set tag to alpha and do not enable tag_latest
|
|
|
|
# If env.IS_PRERELEASE is not true (aka false), don't set an extra tag and enable tag_latest
|
|
|
|
echo "::set-output name=tag::${{ env.IS_PRERELEASE == 'true' && 'alpha' }}"
|
|
|
|
echo "::set-output name=tag_latest::${{ env.IS_PRERELEASE == 'true' && 'false' || 'true' }}"
|
|
|
|
|
|
|
|
release-container:
|
|
|
|
needs: release-container-prereq
|
|
|
|
uses: ./.github/workflows/reusable-container-workflow.yaml
|
|
|
|
with:
|
|
|
|
build_type: prod
|
|
|
|
tag: ${{ needs.release-container-prereq.outputs.tag }}
|
|
|
|
tag_latest: ${{ needs.release-container-prereq.outputs.tag_latest == 'true' }}
|
|
|
|
image: ghcr.io/${{ github.repository }}
|
|
|
|
registry: ghcr.io
|
|
|
|
registry_username: ${{ github.repository_owner }}
|
|
|
|
fetch_release: true
|
|
|
|
release_version: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
|
|
|
secrets:
|
|
|
|
registry_password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2022-02-25 16:45:12 +00:00
|
|
|
release:
|
2022-12-23 17:48:15 +00:00
|
|
|
needs: [release-container-prereq, release-container]
|
2022-02-25 16:45:12 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-06-16 06:00:11 +00:00
|
|
|
- name: print_env
|
|
|
|
run: env
|
|
|
|
|
2022-02-25 16:45:12 +00:00
|
|
|
- name: checkout
|
2022-05-31 14:42:05 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-07-06 09:55:10 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-06-06 13:47:59 +00:00
|
|
|
|
2022-11-17 15:02:18 +00:00
|
|
|
- name: Install helm
|
|
|
|
uses: azure/setup-helm@v3
|
|
|
|
|
2023-03-08 18:05:47 +00:00
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
|
2022-06-20 17:25:14 +00:00
|
|
|
- name: Configure Git
|
|
|
|
if: env.IS_PRERELEASE != 'true'
|
|
|
|
run: |
|
|
|
|
git config user.name "$GITHUB_ACTOR"
|
|
|
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
|
|
|
|
|
|
- name: Update helm chart
|
|
|
|
if: env.IS_PRERELEASE != 'true'
|
|
|
|
run: |
|
2022-07-06 09:55:10 +00:00
|
|
|
git checkout main
|
2022-06-20 17:25:14 +00:00
|
|
|
sed -Ei \
|
|
|
|
-e 's/^(version\:) .*/\1 '${{ env.TAG_NAME }}'/g' \
|
|
|
|
-e 's/^(appVersion\:) .*/\1 "'${{ env.TAG_NAME }}'"/g' \
|
|
|
|
contrib/charts/dragonfly/Chart.yaml
|
|
|
|
|
2023-03-08 18:05:47 +00:00
|
|
|
go test ./contrib/charts/dragonfly/... -update
|
|
|
|
|
2022-06-20 17:25:14 +00:00
|
|
|
git commit \
|
|
|
|
-m 'chore(helm-chart): update to ${{ env.TAG_NAME }}' \
|
2023-03-08 18:05:47 +00:00
|
|
|
contrib/charts/dragonfly/Chart.yaml \
|
|
|
|
contrib/charts/dragonfly/ci
|
2022-06-20 17:25:14 +00:00
|
|
|
|
2022-11-17 15:02:18 +00:00
|
|
|
- name: Push Helm chart as OCI to Github
|
|
|
|
if: env.IS_PRERELEASE != 'true'
|
|
|
|
run: |
|
|
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
|
|
|
helm registry login -u ${{ github.actor }} --password-stdin ghcr.io
|
|
|
|
|
|
|
|
helm package contrib/charts/dragonfly
|
|
|
|
|
|
|
|
helm push dragonfly-${{ env.TAG_NAME }}.tgz oci://ghcr.io/${{ github.repository }}/helm
|
|
|
|
|
2022-07-06 09:55:10 +00:00
|
|
|
- name: GitHub Push
|
|
|
|
uses: CasperWA/push-protected@v2
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.DRAGONFLY_TOKEN }}
|
2022-10-12 05:03:43 +00:00
|
|
|
branch: main
|
|
|
|
|
|
|
|
- name: Discord notification
|
|
|
|
env:
|
|
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
|
|
uses: Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9
|
|
|
|
with:
|
2022-10-23 18:44:06 +00:00
|
|
|
args: 'DragonflyDB version [${{ env.TAG_NAME }}](https://github.com/dragonflydb/dragonfly/releases/tag/${{ env.TAG_NAME }}) has been released 🎉'
|
2023-03-07 14:01:50 +00:00
|
|
|
|
|
|
|
- name: Re-build Docs
|
|
|
|
if: env.IS_PRERELEASE != 'true'
|
|
|
|
run: |
|
|
|
|
curl -s -X POST '${{ secrets.VERCEL_DOCS_WEBHOOK }}'
|