Earl Warren
86c586941a
(cherry picked from commit f67a3f952cac7b9390b9dd2752bdf215a82e04b0) (cherry picked from commit 23502a9b9fa92013d91295d8c9278601b31228c5) (cherry picked from commit f8f345ae188fbf8f62e1471e7cc62a2db33d3e0e) (cherry picked from commit e00eb6d9b32cbb294defb420e0305c544b9af239) (cherry picked from commit f5f5eb53fa8cbd79473b3c6feccf54251c332f82)
170 lines
6.4 KiB
YAML
170 lines
6.4 KiB
YAML
#
|
|
# See also https://forgejo.org/docs/next/developer/RELEASE/#release-process
|
|
#
|
|
# https://codeberg.org/forgejo-integration/forgejo
|
|
#
|
|
# Builds a release from a codeberg.org/forgejo-integration tag
|
|
#
|
|
# vars.ROLE: forgejo-integration
|
|
#
|
|
# secrets.DOER: forgejo-experimental-ci
|
|
# secrets.TOKEN: <generated from codeberg.org/forgejo-experimental-ci> scope read:user, write:repository, write:package
|
|
#
|
|
# secrets.CASCADE_ORIGIN_TOKEN: <generated from codeberg.org/forgejo-experimental-ci> scope read:user, write:repository, write:issue
|
|
# secrets.CASCADE_DESTINATION_TOKEN: <generated from code.forgejo.org/forgejo-ci> scope read:user, write:repository, write:issue
|
|
# vars.CASCADE_DESTINATION_DOER: forgejo-ci
|
|
#
|
|
name: Build release
|
|
|
|
on:
|
|
push:
|
|
tags: 'v*'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: self-hosted
|
|
# root is used for testing, allow it
|
|
if: vars.ROLE == 'forgejo-integration' || github.repository_owner == 'root'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Sanitize the name of the repository
|
|
id: repository
|
|
run: |
|
|
repository="${{ github.repository }}"
|
|
echo "value=${repository##*/}" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: https://code.forgejo.org/actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- uses: https://code.forgejo.org/actions/setup-go@v4
|
|
with:
|
|
go-version: ">=1.21"
|
|
check-latest: true
|
|
|
|
- name: version from ref_name
|
|
id: tag-version
|
|
run: |
|
|
version="${{ github.ref_name }}"
|
|
version=${version##*v}
|
|
echo "value=$version" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: release notes
|
|
id: release-notes
|
|
run: |
|
|
anchor=${{ steps.tag-version.outputs.value }}
|
|
anchor=${anchor//./-}
|
|
cat >> "$GITHUB_OUTPUT" <<EOF
|
|
value<<ENDVAR
|
|
See https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#$anchor
|
|
ENDVAR
|
|
EOF
|
|
|
|
- name: Build sources
|
|
run: |
|
|
set -x
|
|
apt-get -qq install -y make
|
|
version=${{ steps.tag-version.outputs.value }}
|
|
#
|
|
# Make sure all files are owned by the current user.
|
|
# When run as root `npx webpack` will assume the identity
|
|
# of the owner of the current working directory and may
|
|
# fail to create files if some sub-directories are not owned
|
|
# by the same user.
|
|
#
|
|
# Binaries:
|
|
# Node: 18.17.0 - /usr/local/node-v18.17.0-linux-x64/bin/node
|
|
# npm: 9.6.7 - /usr/local/node-v18.17.0-linux-x64/bin/npm
|
|
# Packages:
|
|
# add-asset-webpack-plugin: 2.0.1 => 2.0.1
|
|
# css-loader: 6.8.1 => 6.8.1
|
|
# esbuild-loader: 3.0.1 => 3.0.1
|
|
# license-checker-webpack-plugin: 0.2.1 => 0.2.1
|
|
# monaco-editor-webpack-plugin: 7.0.1 => 7.0.1
|
|
# vue-loader: 17.2.2 => 17.2.2
|
|
# webpack: 5.87.0 => 5.87.0
|
|
# webpack-cli: 5.1.4 => 5.1.4
|
|
#
|
|
chown -R $(id -u) .
|
|
make VERSION=$version TAGS=bindata sources-tarbal
|
|
mv dist/release release
|
|
|
|
(
|
|
tmp=$(mktemp -d)
|
|
tar --directory $tmp -zxvf release/*$version*.tar.gz
|
|
cd $tmp/*
|
|
#
|
|
# Verify `make frontend` files are available
|
|
#
|
|
test -d public/assets/css
|
|
test -d public/assets/fonts
|
|
test -d public/assets/js
|
|
#
|
|
# Verify `make generate` files are available
|
|
#
|
|
test -f modules/public/bindata.go
|
|
#
|
|
# Sanity check to verify that the source tarbal knows the
|
|
# version and is able to rebuild itself from it.
|
|
#
|
|
# When in sources the version is determined with git.
|
|
# When in the tarbal the version is determined from a VERSION file.
|
|
#
|
|
make sources-tarbal
|
|
tarbal=$(echo dist/release/*$version*.tar.gz)
|
|
if ! test -f $tarbal ; then
|
|
echo $tarbal does not exist
|
|
find dist release
|
|
exit 1
|
|
fi
|
|
)
|
|
|
|
- name: build container & release
|
|
if: ${{ secrets.TOKEN != '' }}
|
|
uses: https://code.forgejo.org/forgejo/forgejo-build-publish/build@v1
|
|
with:
|
|
forgejo: "${{ env.GITHUB_SERVER_URL }}"
|
|
owner: "${{ env.GITHUB_REPOSITORY_OWNER }}"
|
|
repository: "${{ steps.repository.outputs.value }}"
|
|
doer: "${{ secrets.DOER }}"
|
|
tag-version: "${{ steps.tag-version.outputs.value }}"
|
|
token: "${{ secrets.TOKEN }}"
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v6
|
|
release-notes: "${{ steps.release-notes.outputs.value }}"
|
|
binary-name: forgejo
|
|
binary-path: /app/gitea/gitea
|
|
verbose: ${{ vars.VERBOSE || 'false' }}
|
|
|
|
- name: build rootless container
|
|
if: ${{ secrets.TOKEN != '' }}
|
|
uses: https://code.forgejo.org/forgejo/forgejo-build-publish/build@v1
|
|
with:
|
|
forgejo: "${{ env.GITHUB_SERVER_URL }}"
|
|
owner: "${{ env.GITHUB_REPOSITORY_OWNER }}"
|
|
repository: "${{ steps.repository.outputs.value }}"
|
|
doer: "${{ secrets.DOER }}"
|
|
tag-version: "${{ steps.tag-version.outputs.value }}"
|
|
token: "${{ secrets.TOKEN }}"
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v6
|
|
suffix: -rootless
|
|
dockerfile: Dockerfile.rootless
|
|
verbose: ${{ vars.VERBOSE || 'false' }}
|
|
|
|
- name: end-to-end tests
|
|
if: ${{ secrets.TOKEN != '' && vars.ROLE == 'forgejo-integration' }}
|
|
uses: https://code.forgejo.org/actions/cascading-pr@v1
|
|
with:
|
|
origin-url: ${{ env.GITHUB_SERVER_URL }}
|
|
origin-repo: ${{ github.repository }}
|
|
origin-token: ${{ secrets.CASCADE_ORIGIN_TOKEN }}
|
|
origin-ref: refs/heads/forgejo
|
|
destination-url: https://code.forgejo.org
|
|
destination-fork-repo: ${{ vars.CASCADE_DESTINATION_DOER }}/end-to-end
|
|
destination-repo: forgejo/end-to-end
|
|
destination-branch: forgejo-pr
|
|
destination-token: ${{ secrets.CASCADE_DESTINATION_TOKEN }}
|
|
update: .forgejo/cascading-release-end-to-end
|
|
env:
|
|
FORGEJO_BINARY: "${{ env.GITHUB_SERVER_URL }}/${{ github.repository }}/releases/download/v${{ steps.tag-version.outputs.value }}/forgejo-${{ steps.tag-version.outputs.value }}-linux-amd64"
|