2023-05-11 08:56:11 +08:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v[0-9]+.[0-9]+.[0-9]+
|
|
|
|
- v[0-9]+.[0-9]+.[0-9]+-*
|
|
|
|
|
|
|
|
name: draft release
|
|
|
|
jobs:
|
|
|
|
draft_release:
|
|
|
|
name: draft release
|
|
|
|
runs-on: ubuntu-latest
|
2023-06-02 22:26:20 +08:00
|
|
|
permissions:
|
|
|
|
packages: write
|
2023-06-06 18:52:09 +08:00
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
2023-05-11 08:56:11 +08:00
|
|
|
steps:
|
|
|
|
|
2023-08-22 01:00:56 +08:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
2023-05-11 08:56:11 +08:00
|
|
|
- name: Checkout repo
|
2023-09-08 02:10:49 +08:00
|
|
|
uses: actions/checkout@v4
|
2023-05-11 08:56:11 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-08-22 01:00:56 +08:00
|
|
|
# Why "fetch-depth: 0"? To generate the release notes, we need the
|
|
|
|
# full git history. A shallow checkout would make release notes going
|
|
|
|
# back one commit.
|
2023-05-11 08:56:11 +08:00
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
|
|
|
|
2023-06-02 22:26:20 +08:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-05-11 08:56:11 +08:00
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
2023-05-12 22:52:31 +08:00
|
|
|
go-version: ^1.20
|
2023-05-11 08:56:11 +08:00
|
|
|
|
2023-05-12 22:52:31 +08:00
|
|
|
# For some reason goreleaser isn't correctly setting the version
|
|
|
|
# string used by "dnscontrol version". Therefore, we're forcing the
|
|
|
|
# string using the GORELEASER_CURRENT_TAG feature.
|
|
|
|
# TODO(tlim): Use the native gorelease version mechanism.
|
|
|
|
|
2023-05-12 22:55:15 +08:00
|
|
|
- name: Retrieve version
|
|
|
|
id: version
|
|
|
|
run: |
|
|
|
|
echo "TAG_NAME=$(git config --global --add safe.directory /__w/dnscontrol/dnscontrol ; git describe --tags)" >> $GITHUB_OUTPUT
|
2023-05-12 22:52:31 +08:00
|
|
|
|
2023-05-12 22:55:15 +08:00
|
|
|
- name: Reveal version
|
|
|
|
run: echo ${{ steps.version.outputs.TAG_NAME }}
|
2023-08-22 01:00:56 +08:00
|
|
|
-
|
|
|
|
id: release
|
|
|
|
name: Goreleaser release
|
|
|
|
uses: goreleaser/goreleaser-action@v4
|
|
|
|
with:
|
|
|
|
distribution: goreleaser
|
|
|
|
version: latest
|
|
|
|
args: release
|
2023-05-11 08:56:11 +08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-05-12 22:52:31 +08:00
|
|
|
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}
|