From 102b3738a22da1a9ab1d5d8a90bb90d1ddcb3941 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 18 Feb 2024 12:52:24 +0100 Subject: [PATCH 1/4] [RELEASE] copy the release to forgejo-experimental if tests pass --- .forgejo/workflows/build-release.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index b2f3757980..497885c335 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -14,8 +14,6 @@ # secrets.CASCADE_DESTINATION_TOKEN: scope read:user, write:repository, write:issue # vars.CASCADE_DESTINATION_DOER: forgejo-ci # -name: Build release - on: push: tags: 'v[0-9]+.[0-9]+.*' @@ -177,7 +175,7 @@ jobs: - name: end-to-end tests if: ${{ secrets.TOKEN != '' && vars.ROLE == 'forgejo-integration' }} - uses: https://code.forgejo.org/actions/cascading-pr@v1 + uses: https://code.forgejo.org/actions/cascading-pr@v2 with: origin-url: ${{ env.GITHUB_SERVER_URL }} origin-repo: ${{ github.repository }} @@ -191,3 +189,25 @@ jobs: update: .forgejo/cascading-release-end-to-end env: FORGEJO_BINARY: "${{ env.GITHUB_SERVER_URL }}/${{ github.repository }}/releases/download/v${{ steps.release-info.outputs.version }}/forgejo-${{ steps.release-info.outputs.version }}-linux-amd64" + + - name: copy to experimental + if: vars.ROLE == 'forgejo-integration' && secrets.TOKEN != '' + run: | + if test "${{ vars.VERBOSE }}" = true ; then + set -x + fi + tag=v${{ steps.release-info.outputs.version }} + url=https://any:${{ secrets.TOKEN }}@codeberg.org + if test "${{ steps.release-info.outputs.override }}" = "true" ; then + curl -sS -X DELETE $url/api/v1/repos/forgejo-experimental/forgejo/releases/tags/$tag > /dev/null + curl -sS -X DELETE $url/api/v1/repos/forgejo-experimental/forgejo/tags/$tag > /dev/null + fi + # actions/checkout@v3 sets http.https://codeberg.org/.extraheader with the automatic token. + # Get rid of it so it does not prevent using the token that has write permissions + git config --local --unset http.https://codeberg.org/.extraheader + if test -f .git/shallow ; then + echo "unexptected .git/shallow file is present" + echo "it suggests a checkout --depth X was used which may prevent pushing the commit" + echo "it happens when actions/checkout is called without depth: 0" + fi + git push $url/forgejo-experimental/forgejo ${{ steps.release-info.outputs.sha }}:refs/tags/$tag From aef5f441692e8b6124f863c9a5e712c3026880d0 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 18 Feb 2024 16:05:42 +0100 Subject: [PATCH 2/4] [RELEASE] do not limit clone depth when building a release otherwise git describe may not produce a tag based version number --- .forgejo/workflows/build-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index 497885c335..bb37128fbc 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -28,6 +28,8 @@ jobs: if: vars.ROLE == 'forgejo-integration' || github.repository_owner == 'root' steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Sanitize the name of the repository id: repository @@ -64,6 +66,7 @@ jobs: exit 1 fi version=${version#v} + git describe --tags --always echo "sha=${{ github.sha }}" >> "$GITHUB_OUTPUT" echo "version=$version" >> "$GITHUB_OUTPUT" echo "override=$override" >> "$GITHUB_OUTPUT" From 004b772b5c66e4bb92fc2b2c8681190ba78e705f Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 18 Feb 2024 21:44:42 +0100 Subject: [PATCH 3/4] [RELEASE] cache node_modules --- .dockerignore | 1 - .forgejo/workflows/build-release.yml | 12 ++++++++++++ Dockerfile | 2 +- Dockerfile.rootless | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 80cbeb040c..d1a08977a5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -71,7 +71,6 @@ cpu.out /tests/e2e/test-artifacts /tests/e2e/test-snapshots /tests/*.ini -/node_modules /yarn.lock /yarn-error.log /npm-debug.log* diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index bb37128fbc..8eac55e561 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -82,6 +82,18 @@ jobs: ENDVAR EOF + - name: cache node_modules + id: node + uses: https://code.forgejo.org/actions/cache@v3 + with: + path: | + node_modules + key: node-${{ steps.release-info.outputs.version }} + + - name: skip if node cache hit + if: steps.node.outputs.cache-hit != 'true' + run: echo no hit + - name: Build sources run: | set -x diff --git a/Dockerfile b/Dockerfile index 81a34d5d23..c7c15c0b52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,7 @@ RUN apk --no-cache add build-base git nodejs npm COPY . ${GOPATH}/src/code.gitea.io/gitea WORKDIR ${GOPATH}/src/code.gitea.io/gitea -RUN make clean-all +RUN make clean RUN make frontend RUN go build contrib/environment-to-ini/environment-to-ini.go && xx-verify environment-to-ini RUN make RELEASE_VERSION=$RELEASE_VERSION go-check generate-backend static-executable && xx-verify gitea diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 83b19f4dcc..bf3c92bbc5 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -33,7 +33,7 @@ RUN apk --no-cache add build-base git nodejs npm COPY . ${GOPATH}/src/code.gitea.io/gitea WORKDIR ${GOPATH}/src/code.gitea.io/gitea -RUN make clean-all +RUN make clean RUN make frontend RUN go build contrib/environment-to-ini/environment-to-ini.go && xx-verify environment-to-ini RUN make RELEASE_VERSION=$RELEASE_VERSION go-check generate-backend static-executable && xx-verify gitea From 00d175701ed00fcfdc621a375769279886978c77 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 19 Feb 2024 01:39:29 +0100 Subject: [PATCH 4/4] [RELEASE] use 0.0-test instead of forgejo-test so that it is a valid semver version instead of not --- .forgejo/workflows/build-release-integration.yml | 2 +- .forgejo/workflows/build-release.yml | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/build-release-integration.yml b/.forgejo/workflows/build-release-integration.yml index cdcbf32627..ab2f2ebc10 100644 --- a/.forgejo/workflows/build-release-integration.yml +++ b/.forgejo/workflows/build-release-integration.yml @@ -110,7 +110,7 @@ jobs: # # Push a commit to a branch that triggers the build of a test release # - version=forgejo-test + version=0.0-test ( git clone $url/root/forgejo /tmp/forgejo cd /tmp/forgejo diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index 8eac55e561..e619c4dd27 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -53,8 +53,12 @@ jobs: set -x ref="${{ github.ref }}" if [[ $ref =~ ^refs/heads/ ]] ; then - version=${ref#refs/heads/} - version=${version%/forgejo}-test + if test "$ref" = "refs/heads/forgejo" ; then + version=0.0-test + else + version=${ref#refs/heads/} + version=${version%/forgejo}-test + fi override=true fi if [[ $ref =~ ^refs/tags/ ]] ; then