Переглянути джерело

docs: update release templates and playbook (#6735)

[skip ci]
Joe Chen 3 роки тому
батько
коміт
2071eb634f

+ 15 - 8
.github/ISSUE_TEMPLATE/dev_release_minor_version.md

@@ -5,29 +5,35 @@ title: "Release [VERSION]"
 labels: 📸 release
 ---
 
+_This is generated from the [minor release template](https://github.com/gogs/gogs/blob/main/.github/ISSUE_TEMPLATE/dev_release_minor_version.md)._
+
 ## Before release
 
 On the `main` branch:
 
 - [ ] Close stale issues with the label [status: needs feedback](https://github.com/gogs/gogs/issues?q=is%3Aissue+is%3Aopen+label%3A%22status%3A+needs+feedback%22).
 - [ ] [Sync locales from Crowdin](https://github.com/gogs/gogs/blob/main/docs/dev/import_locale.md).
-- [ ] Update [CHANGELOG](https://github.com/gogs/gogs/blob/main/CHANGELOG.md) to include entries for the current release.
+- [ ] [Update CHANGELOG](https://github.com/gogs/gogs/commit/720cb5fcb169b9e026b5b47f57d50888b35fdb4b) to include entries for the current minor release.
 - [ ] Cut a new release branch `release/<MAJOR>.<MINOR>`, e.g. `release/0.12`.
 
 ## During release
 
 On the release branch:
 
-- [ ] Update the [hard-coded version](https://github.com/gogs/gogs/blob/main/gogs.go#L22) to the current release, e.g. `0.12.0+dev` -> `0.12.0`.
-- [ ] Publish a new [GitHub release](https://github.com/gogs/gogs/releases) with entries from [CHANGELOG](https://github.com/gogs/gogs/blob/main/CHANGELOG.md) for the current release.
-- [ ] Wait for a new image tag for the current release to be created automatically on both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs).
-- [ ] Push another Docker image tag as `<MAJOR>.<MINOR>`, e.g. `0.12` to both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs).
-- [ ] Compile and pack binaries (all prefixed with `gogs_<MAJOR>.<MINOR>.<PATCH>_`, e.g. `gogs_0.12.0_`):
+- [ ] [Update the hard-coded version](https://github.com/gogs/gogs/commit/f17e7d5a2c36c52a1121d2315f3d75dcd8053b89) to the current release, e.g. `0.12.0+dev` -> `0.12.0`.
+- [ ] Wait for GitHub Actions to complete and no failed jobs.
+- [ ] Publish new RC releases (e.g. `v0.12.0-rc.1`, `v0.12.0-rc.2`) to ensure Docker wrokflow succeeds. **Make sure the tag is created on the release branch**.
+	- [ ] Pull down the Docker image and [run through application setup](https://github.com/gogs/gogs/blob/main/docker/README.md) to make sure nothing blows up.
+- [ ] - [ ] Publish a new [GitHub release](https://github.com/gogs/gogs/releases) with entries from [CHANGELOG](https://github.com/gogs/gogs/blob/main/CHANGELOG.md) for the current minor release. **Make sure the tag is created on the release branch**.
+	- [ ] Only mention patch authors for the current release.
+- [ ] [Wait for a new image tag for the current release](https://github.com/gogs/gogs/actions/workflows/docker.yml?query=event%3Arelease) to be created automatically on both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs).
+- [ ] [Push a new Docker image tag](https://github.com/gogs/gogs/blob/main/docs/dev/release/release_new_version.md#update-docker-image-tag) as `<MAJOR>.<MINOR>` to both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs), e.g.:
+- [ ] [Compile and pack binaries](https://github.com/gogs/gogs/blob/main/docs/dev/release/release_new_version.md#compile-and-pack-binaries) (all prefixed with `gogs_<MAJOR>.<MINOR>.<PATCH>_`, e.g. `gogs_0.12.0_`):
 	- [ ] macOS: `darwin_amd64.zip`, `darwin_arm64.zip`
 	- [ ] Linux: `linux_386.tar.gz`, `linux_386.zip`, `linux_amd64.tar.gz`, `linux_amd64.zip`
 	- [ ] ARM: `linux_armv7.tar.gz`, `linux_armv7.zip`, `linux_armv8.tar.gz`, `linux_armv8.zip`
 	- [ ] Windows: `windows_amd64.zip`, `windows_amd64_mws.zip`
-- [ ] Generate SHA256 checksum for all binaries to the file `checksum_sha256.txt`.
+- [ ] [Generate SHA256 checksum](https://github.com/gogs/gogs/blob/main/docs/dev/release/sha256.sh) for all binaries to the file `checksum_sha256.txt`.
 - [ ] Upload all binaries to:
 	- [ ] GitHub release
 	- [ ] https://dl.gogs.io (also upload `checksum_sha256.txt`)
@@ -39,7 +45,8 @@ On the `main` branch:
 
 - [ ] Update the repository mirror on [Gitee](https://gitee.com/unknwon/gogs).
 - [ ] Create a new release announcement in [Discussions](https://github.com/gogs/gogs/discussions/categories/announcements).
+- [ ] Send a tweet on the [official Twitter account](https://twitter.com/GogsHQ) for the minor release.
 - [ ] Send out release announcement emails via [Mailchimp](https://mailchimp.com/).
 - [ ] Publish a new release article on [OSChina](http://my.oschina.net/Obahua/admin/releases).
-- [ ] Bump the [hard-coded version](https://github.com/gogs/gogs/blob/main/gogs.go#L22) to the new develop version, e.g. `0.12.0+dev` -> `0.13.0+dev`.
+- [ ] [Bump the hard-coded version](https://github.com/gogs/gogs/commit/05477f1d294dc43f36c4a3b3b9575a96aea66a67) to the new develop version, e.g. `0.12.0+dev` -> `0.13.0+dev`.
 - [ ] Run `task legacy` to identify deprecated code that is aimed to be removed in current develop version.

+ 13 - 6
.github/ISSUE_TEMPLATE/dev_release_patch_version.md

@@ -5,33 +5,39 @@ title: "Release [VERSION]"
 labels: 📸 release
 ---
 
+_This is generated from the [patch release template](https://github.com/gogs/gogs/blob/main/.github/ISSUE_TEMPLATE/dev_release_patch_version.md)._
+
 ## Before release
 
 On the release branch:
 
 - [ ] Make sure all commits are cherry-picked from the `main` branch by checking the patch milestone.
-- [ ] Update [CHANGELOG](https://github.com/gogs/gogs/blob/main/CHANGELOG.md) to include entries for the current patch release, e.g. `git log v0.12.1...HEAD --pretty=format:'- [ ] %H %s' --reverse`:
+- [ ] Run `git log v0.12.1...HEAD --pretty=format:'- [ ] %H %s' --reverse` (where `v0.12.1` is the last patch release) to get the list of new commits and paste the output below:
 	- [ ] _link to the commit_
+- [ ] [Update CHANGELOG on the `main` branch](https://github.com/gogs/gogs/commit/e6c5633f580399c8f4dfc07166a63a01c6c70346) to include entries for the current patch release.
 
 ## During release
 
 On the release branch:
 
-- [ ] Update the [hard-coded version](https://github.com/gogs/gogs/blob/main/gogs.go#L22) to the current release, e.g. `0.12.0` -> `0.12.1`.
+- [ ] [Update the hard-coded version](https://github.com/gogs/gogs/commit/f0e3cd90f8d7695960eeef2e4e54b2e717302f6c) to the current release, e.g. `0.12.0` -> `0.12.1`.
 - [ ] Wait for GitHub Actions to complete and no failed jobs.
+- [ ] Publish new RC releases (e.g. `v0.12.0-rc.1`, `v0.12.0-rc.2`) to ensure Docker wrokflow succeeds. **Make sure the tag is created on the release branch**.
+	- [ ] Pull down the Docker image and [run through application setup](https://github.com/gogs/gogs/blob/main/docker/README.md) to make sure nothing blows up.
 - [ ] Publish a new [GitHub release](https://github.com/gogs/gogs/releases) with entries from [CHANGELOG](https://github.com/gogs/gogs/blob/main/CHANGELOG.md) for the current patch release and all previous releases with same minor version. **Make sure the tag is created on the release branch**.
+	- [ ] Only mention patch authors for the current release.
 - [ ] Update all previous GitHub releases with same minor version with the warning:
 	```
 	**ℹ️ Heads up! There is a new patch release [0.12.1](https://github.com/gogs/gogs/releases/tag/v0.12.1) available, we recommend directly installing or upgrading to that version.**
 	```
-- [ ] Wait for a new image tag for the current release to be created automatically on both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs).
-- [ ] Update Docker image tag for the minor release `<MAJOR>.<MINOR>`, e.g. `0.12` on both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs).
-- [ ] Compile and pack binaries (all prefixed with `gogs_<MAJOR>.<MINOR>.<PATCH>_`, e.g. `gogs_0.12.0_`):
+- [ ] [Wait for a new image tag for the current release](https://github.com/gogs/gogs/actions/workflows/docker.yml?query=event%3Arelease) to be created automatically on both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs).
+- [ ] [Update Docker image tag](https://github.com/gogs/gogs/blob/main/docs/dev/release/release_new_version.md#update-docker-image-tag) for the minor release `<MAJOR>.<MINOR>` on both [Docker Hub](https://hub.docker.com/r/gogs/gogs/tags) and [GitHub Container registry](https://github.com/gogs/gogs/pkgs/container/gogs).
+- [ ] [Compile and pack binaries](https://github.com/gogs/gogs/blob/main/docs/dev/release/release_new_version.md#compile-and-pack-binaries) (all prefixed with `gogs_<MAJOR>.<MINOR>.<PATCH>_`, e.g. `gogs_0.12.0_`):
 	- [ ] macOS: `darwin_amd64.zip`, `darwin_arm64.zip`
 	- [ ] Linux: `linux_386.tar.gz`, `linux_386.zip`, `linux_amd64.tar.gz`, `linux_amd64.zip`
 	- [ ] ARM: `linux_armv7.tar.gz`, `linux_armv7.zip`, `linux_armv8.tar.gz`, `linux_armv8.zip`
 	- [ ] Windows: `windows_amd64.zip`, `windows_amd64_mws.zip`
-- [ ] Generate SHA256 checksum for all binaries to the file `checksum_sha256.txt`.
+- [ ] [Generate SHA256 checksum](https://github.com/gogs/gogs/blob/main/docs/dev/release/sha256.sh) for all binaries to the file `checksum_sha256.txt`.
 - [ ] Upload all binaries to:
 	- [ ] GitHub release
 	- [ ] https://dl.gogs.io (also upload `checksum_sha256.txt`)
@@ -47,4 +53,5 @@ On the `main` branch:
     ```
 - [ ] Update the repository mirror on [Gitee](https://gitee.com/unknwon/gogs).
 - [ ] Reply to the release topic for the minor release in [Discussions](https://github.com/gogs/gogs/discussions/categories/announcements).
+- [ ] Send a tweet on the [official Twitter account](https://twitter.com/GogsHQ) for the patch release.
 - [ ] Close the patch milestone.

+ 1 - 0
.github/workflows/docker.yml

@@ -146,6 +146,7 @@ jobs:
           context: .
           platforms: linux/amd64
 
+  # Updates to the following section needs to be synced to all release branches within their lifecycles.
   buildx-release:
     if: ${{ github.event_name == 'release' }}
     runs-on: ubuntu-latest

+ 7 - 3
Taskfile.yml

@@ -1,5 +1,9 @@
 version: '3'
 
+vars:
+  BINARY_EXT:
+    sh: echo '{{if eq OS "windows"}}.exe{{end}}'
+
 tasks:
   web:
     desc: Build the binary and start the web server.
@@ -16,7 +20,7 @@ tasks:
           -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}"
         '
         -tags '{{.TAGS}}'
-        -trimpath -o gogs
+        -trimpath -o gogs{{.BINARY_EXT}}
     vars:
       PKG_PATH: gogs.io/gogs/internal/conf
       BUILD_TIME:
@@ -60,8 +64,8 @@ tasks:
     cmds:
       - rm -rf {{.RELEASE_GOGS}}
       - mkdir -p {{.RELEASE_GOGS}}
-      - cp -r gogs LICENSE README.md README_ZH.md scripts {{.RELEASE_GOGS}}
-      - cd {{.RELEASE_ROOT}} && zip -r gogs.$(NOW).zip "gogs"
+      - cp -r gogs{{.BINARY_EXT}} LICENSE README.md README_ZH.md scripts {{.RELEASE_GOGS}}
+      - cd {{.RELEASE_ROOT}} && zip -r gogs.zip "gogs"
     vars:
       RELEASE_ROOT: release
       RELEASE_GOGS: release/gogs

+ 1 - 1
docker/s6/.s6-svscan/finish

@@ -1,5 +1,5 @@
 #!/bin/sh
 
-# Cleanup SOCAT services and s6 event folder
+# Cleanup SOCAT services and s6 event folder
 rm -rf "$(find /app/gogs/docker/s6/ -name 'event')"
 rm -rf /app/gogs/docker/s6/SOCAT_*

+ 81 - 0
docs/dev/release/release_new_version.md

@@ -0,0 +1,81 @@
+# Release a new version
+
+- To release a new minor version, use the GitHub issue template [Dev: Release a minor version](https://github.com/gogs/gogs/issues/new?title=Release+<MAJOR>.<MINOR>.0&labels=%F0%9F%93%B8%20release&template=dev_release_minor_version.md).
+- To release a new patch version, use the GitHub issue template [Dev: Release a patch version](https://github.com/gogs/gogs/issues/new?title=Release+<MAJOR>.<MINOR>.<PATCH>&labels=%F0%9F%93%B8%20release&template=dev_release_patch_version.md).
+
+## Playbooks
+
+### Update Docker image tag
+
+1. Pull down images and create a manifest:
+    ```sh
+    $ export VERSION=0.12.4
+    $ export MINOR_RELEASE=0.12
+
+    $ docker pull --platform linux/amd64 gogs/gogs:${VERSION}
+    $ docker tag gogs/gogs:${VERSION} gogs/gogs:${MINOR_RELEASE}-amd64
+    $ docker push gogs/gogs:${MINOR_RELEASE}-amd64
+    $ docker pull --platform linux/arm64 gogs/gogs:${VERSION}
+    $ docker tag gogs/gogs:${VERSION} gogs/gogs:${MINOR_RELEASE}-arm64
+    $ docker push gogs/gogs:${MINOR_RELEASE}-arm64
+    $ docker pull --platform linux/arm/v7 gogs/gogs:${VERSION}
+    $ docker tag gogs/gogs:${VERSION} gogs/gogs:${MINOR_RELEASE}-armv7
+    $ docker push gogs/gogs:${MINOR_RELEASE}-armv7
+
+    $ docker manifest create \
+    	gogs/gogs:${MINOR_RELEASE} \
+    	--amend gogs/gogs:${MINOR_RELEASE}-amd64 \
+    	--amend gogs/gogs:${MINOR_RELEASE}-arm64 \
+    	--amend gogs/gogs:${MINOR_RELEASE}-armv7
+    $ docker manifest push gogs/gogs:${MINOR_RELEASE}
+
+    # Only push "linux/amd64" for now
+    $ echo ${GITHUB_CR_PAT} | docker login ghcr.io -u <USERNAME> --password-stdin
+    $ docker pull --platform linux/amd64 gogs/gogs:${VERSION}
+    $ docker tag gogs/gogs:${VERSION} ghcr.io/gogs/gogs:${MINOR_RELEASE}
+    $ docker push ghcr.io/gogs/gogs:${MINOR_RELEASE}
+    ```
+2. Delete ephemeral tags from the [Docker Hub](https://hub.docker.com/repository/docker/gogs/gogs/tags).
+
+### Compile and pack binaries
+
+All commands are starting at the repository root.
+
+- macOS:
+	```sh
+	# Produce the ZIP archive
+	$ TAGS=cert task release
+	```
+- Linux:
+	```sh
+	# Produce the ZIP archive
+	$ TAGS="cert pam" task release
+
+	# Produce the Tarball
+    $ export VERSION=0.12.4
+	$ cd release && tar czf gogs_${VERSION}_linux_$(go env GOARCH).tar.gz gogs
+	```
+- ARMv7:
+	```sh
+	# Extract the binary from the Docker image
+	$ docker pull --platform linux/arm/v7 gogs/gogs:${VERSION}
+	$ docker run \
+		--platform linux/arm/v7 \
+		-v ${PWD}:/opt/mount/ \
+		gogs/gogs:${VERSION} \
+		bash -c "cp /app/gogs/gogs /opt/mount/"
+	```
+- ARMv8:
+	```sh
+	# Produce the ZIP archive
+	$ TAGS="cert pam" task release
+
+	# Produce the Tarball
+    $ export VERSION=0.12.4
+	$ cd release && tar czf gogs_${VERSION}_linux_armv8.tar.gz gogs
+	```
+- Windows:
+	```sh
+	$ TAGS=cert task release
+	$ TAGS="cert minwinsvc" task release
+	```

+ 9 - 0
docs/dev/release/sha256.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cd gogs || exit # "gogs" is the directory that stores all release archives
+for file in *
+do
+    if [ -f "$file" ]; then
+        shasum -a 256 "$file" >> checksum_sha256.txt
+    fi
+done

+ 0 - 9
docs/dev/release_new_version.md

@@ -1,9 +0,0 @@
-# Release a new version
-
-## Release a minor version
-
-To release a new minor version, use the GitHub issue template [Dev: Release a minor version](https://github.com/gogs/gogs/issues/new?title=Release+<MAJOR>.<MINOR>.0&labels=%F0%9F%93%B8%20release&template=dev_release_minor_version.md).
-
-## Release a patch version
-
-To release a new patch version, use the GitHub issue template [Dev: Release a patch version](https://github.com/gogs/gogs/issues/new?title=Release+<MAJOR>.<MINOR>.<PATCH>&labels=%F0%9F%93%B8%20release&template=dev_release_patch_version.md).