Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
name: PyPI deployment
runs-on: "ubuntu-latest"
if: github.event_name != 'push' || github.repository == 'DIRACGrid/WebAppDIRAC'
# Only a release (workflow_dispatch) gets the environment that holds the deploy key.
environment: ${{ github.event_name == 'workflow_dispatch' && 'release' || '' }}
permissions:
contents: write # push the release notes commit and create the GitHub release
contents: write # create the GitHub release on the tag pushed with the deploy key
outputs:
create-release: ${{ steps.check-tag.outputs.create-release }}
new-version: ${{ steps.check-tag.outputs.new-version }}
Expand All @@ -38,10 +40,7 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The PAT is required to push the release notes commit to the protected
# release branches, and its persisted credentials are used for the push.
# zizmor: ignore[secrets-outside-env,artipacked] PAT required to push to the protected release branches
token: ${{ secrets.PAT || github.token }}
persist-credentials: false
- run: |
git fetch --prune --unshallow
git config --global user.email "ci@diracgrid.org"
Expand Down Expand Up @@ -135,10 +134,19 @@ jobs:
NEW_VERSION: ${{ steps.check-tag.outputs.new-version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
# Write deploy key: the only actor allowed past the branch and tag rulesets.
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
run: |
set -e
echo "Pushing tagged release notes to ${GITHUB_REF#refs/heads/}"
git push "origin" "${GITHUB_REF#refs/heads/}"
BRANCH="${GITHUB_REF#refs/heads/}"
install -m 600 /dev/null "${RUNNER_TEMP}/release_key"
printf '%s\n' "${RELEASE_DEPLOY_KEY}" > "${RUNNER_TEMP}/release_key"
# GitHub's SSH host key, from https://api.github.com/meta
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > "${RUNNER_TEMP}/known_hosts"
export GIT_SSH_COMMAND="ssh -i ${RUNNER_TEMP}/release_key -o IdentitiesOnly=yes -o UserKnownHostsFile=${RUNNER_TEMP}/known_hosts"
echo "Pushing the release notes and the ${NEW_VERSION} tag to ${BRANCH}"
git push --atomic "git@github.com:${GH_REPO}.git" "HEAD:refs/heads/${BRANCH}" "refs/tags/${NEW_VERSION}"
rm -f "${RUNNER_TEMP}/release_key"
echo "Making GitHub release for ${NEW_VERSION}"
../DIRAC/.github/workflows/make_release.py \
--repo="${GH_REPO}" \
Expand Down
Loading