Skip to content

4.4.0-beta1

4.4.0-beta1 #80

Workflow file for this run

name: Release Tasks
on:
release:
types:
- published
- edited
- deleted
- released # See: https://github.community/t5/GitHub-API-Development-and/Webhook-ReleaseEvent-prerelease-gt-release-notification/m-p/22612
concurrency: release_tasks
jobs:
trigger-site-update:
name: 'Trigger Site Update'
permissions:
contents: read
runs-on: ubuntu-latest
if: (github.repository == 'Warzone2100/warzone2100')
environment: update_dispatch
# For this job to work, the following secrets must be set in the 'update_dispatch' environment:
# SITE_DISPATCH_ACCESS_TOKEN
# DEPLOY_DISPATCH_ACCESS_TOKEN
steps:
- name: 'Trigger wz2100.net update'
run: |
curl -X POST https://api.github.com/repos/Warzone2100/wz2100.net/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.SITE_DISPATCH_ACCESS_TOKEN }} \
--data '{"event_type": "github_release_update", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
- name: 'Trigger updates.json update'
run: |
curl -X POST https://api.github.com/repos/Warzone2100/update-data/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.SITE_DISPATCH_ACCESS_TOKEN }} \
--data '{"event_type": "github_release_update", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
- name: 'Trigger itch.io deployment'
run: |
curl -X POST https://api.github.com/repos/Warzone2100/itch-build/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.DEPLOY_DISPATCH_ACCESS_TOKEN }} \
--data '{"event_type": "github_release_update", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
- name: 'Trigger MSIX deployment'
if: (github.event.action == 'published') || (github.event.action == 'released')
run: |
curl -X POST https://api.github.com/repos/wz-packaging/wz-ms-packaging/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.DEPLOY_DISPATCH_ACCESS_TOKEN }} \
--data '{"event_type": "github_release_update", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
sentry-release-commit-info:
name: 'Upload Release Commit Info'
permissions:
contents: read
runs-on: ubuntu-latest
if: ((github.event.action == 'published') || (github.event.action == 'released')) && (github.repository == 'Warzone2100/warzone2100')
environment: upload_symbols
# For this job to work, the following secrets must be set in the 'upload_symbols' environment:
# SENTRY_AUTH_TOKEN
steps:
- name: Prep Environment
run: |
mkdir empty-folder
- uses: actions/checkout@v3
with:
fetch-depth: 0
path: 'src'
- name: Prepare Git Repo for autorevision
working-directory: '${{ github.workspace }}/src'
run: cmake -P .ci/githubactions/prepare_git_repo.cmake
- name: 'List tags'
working-directory: '${{ github.workspace }}/src'
run: |
git tag --list
- name: 'Collect release info'
working-directory: '${{ github.workspace }}/src'
run: |
CURRENT_TAG="${GITHUB_REF#refs/tags/}"
echo "CURRENT_TAG=${CURRENT_TAG}"
SENTRY_VERSION="warzone2100@${CURRENT_TAG}"
echo "SENTRY_VERSION=${SENTRY_VERSION}"
# Get commit of prior release tag
PRIOR_TAG="$(git describe --abbrev=0 ${GITHUB_REF}^)"
echo "PRIOR_TAG=${PRIOR_TAG}"
PRIOR_TAG_COMMIT="$(git rev-list -n 1 "refs/tags/${PRIOR_TAG}")"
echo "PRIOR_TAG_COMMIT=${PRIOR_TAG_COMMIT}"
# Get commit of current release tag
CURRENT_TAG_COMMIT="$(git rev-list -n 1 "${GITHUB_REF}")"
echo "CURRENT_TAG_COMMIT=${CURRENT_TAG_COMMIT}"
echo "SENTRY_VERSION=${SENTRY_VERSION}" >> $GITHUB_ENV
echo "PRIOR_TAG_COMMIT=${PRIOR_TAG_COMMIT}" >> $GITHUB_ENV
echo "CURRENT_TAG_COMMIT=${CURRENT_TAG_COMMIT}" >> $GITHUB_ENV
- name: 'Upload Sentry release info'
if: (github.repository == 'Warzone2100/warzone2100')
working-directory: '${{ github.workspace }}/empty-folder'
env:
SENTRY_AUTH_TOKEN: '${{ secrets.SENTRY_AUTH_TOKEN }}'
SENTRY_ORG: 'warzone2100'
run: |
if [[ -z "${SENTRY_AUTH_TOKEN}" ]]; then
echo "No SENTRY_AUTH_TOKEN - skipping"
exit 0
fi
if [[ -z "${SENTRY_VERSION}" ]]; then
echo "No SENTRY_VERSION - skipping"
exit 0
fi
docker pull getsentry/sentry-cli
# Check if release already exists
echo "Checking if release exists: ${SENTRY_VERSION}"
if ! docker run --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -v "$(pwd):/work" getsentry/sentry-cli releases info "${SENTRY_VERSION}" -q; then
# Create the release
echo "Creating the release: ${SENTRY_VERSION}"
docker run --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -v "$(pwd):/work" getsentry/sentry-cli releases new -p warzone2100 "${SENTRY_VERSION}" || echo "Failed to create the release?"
fi
# Associate commits with the release
echo "Associate commits with the release: ${SENTRY_VERSION}"
docker run --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -v "$(pwd):/work" getsentry/sentry-cli releases set-commits "${SENTRY_VERSION}" --commit "Warzone2100/warzone2100@${PRIOR_TAG_COMMIT}..${CURRENT_TAG_COMMIT}"