mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: 🚀 Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'final-*_*_*'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
permissions:
|
|
contents: none
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Set env
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- name: Version URL
|
|
run: |
|
|
VERSION=$(echo ${RELEASE_VERSION} | cut -d '-' -f 2 )
|
|
|
|
if [ ${VERSION: -1} = "0" ]
|
|
then
|
|
VERSION=$(echo ${VERSION} | cut -d '_' -f1,2 | sed 's/_/\./g')
|
|
echo "version_url=https://changelog.qgis.org/en/qgis/version/${VERSION}" >> $GITHUB_ENV
|
|
else
|
|
PREVIOUS=$(echo ${VERSION} | sed 's/_/\./g' | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF-1)%(10^length($NF))); print}' | sed 's/\./_/g')
|
|
echo "version_url=https://github.com/qgis/QGIS/compare/final-${PREVIOUS}%5E...final-${VERSION}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Version name
|
|
run: |
|
|
VERSION_NAME=$(echo ${{ env.RELEASE_VERSION }} | cut -d '-' -f 2 | sed 's/_/\./g')
|
|
echo "version_name=${VERSION_NAME}" >> $GITHUB_ENV
|
|
|
|
- name: Create release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_BOT }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: ${{ env.version_name }}
|
|
body: ${{ env.version_url }}
|
|
draft: false
|
|
prerelease: false
|