Replace release creation with gh CLI (#2608)

* replace release creation with gh CLI

* Create nightly builds abstraction with tag creation

* Enable also workflow dispatch for main nighlty build
This commit is contained in:
Antonis Stamatiou 2023-03-13 18:16:29 +02:00 committed by GitHub
parent 19330bab65
commit 08c4535308
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 32 deletions

View file

@ -1,9 +1,18 @@
name: nightly-browser-view
on:
workflow_call:
inputs:
tag:
description: "Reference tag of the nightly build"
required: true
type: string
workflow_dispatch:
schedule:
- cron: 0 4 * * 0-5
inputs:
tag:
description: "Reference tag of the nightly build"
required: true
type: string
defaults:
run:
@ -12,6 +21,7 @@ defaults:
env:
TERM: xterm
MM_WIN_INSTALLERS: 1
REFERENCE: ${{ inputs.tag }}
jobs:
build-linux:
@ -19,14 +29,14 @@ jobs:
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ env.REFERENCE }}
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
@ -53,14 +63,14 @@ jobs:
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ env.REFERENCE }}
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/optimize
shell: powershell
run: ./scripts/Makefile.ps1 optimize
@ -109,14 +119,14 @@ jobs:
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ env.REFERENCE }}
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/install-dependencies
run: |
brew install yq
@ -139,14 +149,14 @@ jobs:
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ env.REFERENCE }}
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/install-dependencies
run: |
brew install yq rename
@ -185,8 +195,8 @@ jobs:
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
with:
ref: ${{ env.REFERENCE }}
- name: nightly/setup-aws-credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
@ -232,4 +242,4 @@ jobs:
--arg username "NightBuilder" \
--arg text "${{ needs.upload-to-s3.outputs.links }}" \
'{"username":$username,"icon_url": $icon_url, "text": $text }' > /tmp/webhook-data.json
curl -i -X POST -H "Content-Type: application/json" -d @/tmp/webhook-data.json ${{ secrets.MM_DESKTOP_NIGHTLY_WEBHOOK_URL }} || echo "NOFICATION FAILED! check logs as this will succeed intentionally"
curl -i -X POST -H "Content-Type: application/json" -d @/tmp/webhook-data.json ${{ secrets.MM_DESKTOP_NIGHTLY_WEBHOOK_URL }}

View file

@ -1,9 +1,18 @@
name: nightly-rainforest
on:
workflow_call:
inputs:
tag:
description: "Reference tag of the nightly build"
required: true
type: string
workflow_dispatch:
schedule:
- cron: 0 4 * * 0-5
inputs:
tag:
description: "Reference tag of the nightly build"
required: true
type: string
defaults:
run:
@ -14,6 +23,7 @@ env:
MM_DESKTOP_BUILD_DISABLEGPU: true
MM_DESKTOP_BUILD_SKIPONBOARDINGSCREENS: true
MM_WIN_INSTALLERS: 1
REFERENCE: ${{ inputs.tag }}
jobs:
build-msi-installer:
@ -21,14 +31,14 @@ jobs:
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ env.REFERENCE }}
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/optimize
shell: powershell
run: ./scripts/Makefile.ps1 optimize
@ -69,14 +79,14 @@ jobs:
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ env.REFERENCE }}
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/install-dependencies
run: |
brew install yq rename
@ -112,8 +122,8 @@ jobs:
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
with:
ref: ${{ env.REFERENCE }}
- name: nightly/setup-aws-credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:

42
.github/workflows/nightly.yaml vendored Normal file
View file

@ -0,0 +1,42 @@
name: nightly-builds
on:
workflow_dispatch:
schedule:
- cron: 0 4 * * 0-5
jobs:
tag-nightly-build:
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.tag-creation.outputs.tag }}
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/create-nightly-build-tag
id: tag-creation
run: |
git config --global user.email "nightly-build@mattermost.com"
git config --global user.name "Nightly Build"
git checkout -b "$(jq -r .version package.json)"
git add package.json
git commit -m "Nightly build $(jq -r .version package.json)"
git tag "$(jq -r .version package.json)" -m "Nightly build $(jq -r .version package.json)"
git push --tags --force
echo "tag=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
nightly-browser-view:
needs:
- tag-nightly-build
uses: ./.github/workflows/nightly-browser-view.yml
with:
tag: ${{ needs.tag-nightly-build.outputs.tag }}
nightly-rainforest:
needs:
- tag-nightly-build
uses: ./.github/workflows/nightly-rainforest.yml
with:
tag: ${{ needs.tag-nightly-build.outputs.tag }}

View file

@ -228,20 +228,14 @@ jobs:
mkdir -p ./ghr-dist
find ./build/{macos-release,win-release,linux} -type f -exec cp --backup=numbered -t ./ghr-dist {} +
- name: release/publish-release
env:
GITHUB_TOKEN: ${{ secrets.MATTERMOST_BUILD_GH_TOKEN }}
run: |
go install github.com/tcnksm/ghr@latest
VERSION=$(jq -r .version package.json)
./scripts/generate_release_markdown.sh ${VERSION} > release-notes.md
RELEASE_TITLE="v${VERSION} ($(date -u "+%Y-%m-%d"))"
ghr \
-t ${GITHUB_TOKEN} \
-u ${GITHUB_ACTOR} \
-draft \
--body="$(./scripts/generate_release_markdown.sh $VERSION)" \
--name="${RELEASE_TITLE}" $( [[ $VERSION =~ "-rc" ]] && printf %s "-prerelease") \
-r ${GITHUB_REPOSITORY} \
-c ${GITHUB_SHA} \
-delete \
v${VERSION} ./ghr-dist
[[ $VERSION =~ "-rc" ]] && PRERELEASE="--prerelease"
gh release create --draft ${PRERELEASE} --verify-tag -F release-notes.md --target "${GITHUB_SHA}" --title "${RELEASE_TITLE}" "${GITHUB_REF_NAME}" ./ghr-dist/*
end-notification:
runs-on: ubuntu-22.04