Update license copyright year(s) #50
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Release" | |
on: | |
pull_request: | |
types: | |
- "closed" | |
branches: | |
- "main" | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
version: ${{ steps.filter.outputs.version }} | |
steps: | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
version: | |
- 'VERSION' | |
release: | |
needs: changes | |
name: Set tag to current version | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && needs.changes.outputs.version == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version | |
run: | | |
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
- name: Set github tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
github_token: ${{ secrets.PAT_TOKEN }} | |
custom_tag: ${{ env.VERSION }} | |
- name: Get changelog | |
run: | | |
VERSION=$(cat VERSION) | |
CAPTURING_CHANGES=0 | |
while IFS="" read line; do | |
# Set capturing changes if line is a version header | |
if [[ "$line" == "## ["* ]]; then | |
if [[ "$line" == "## [$VERSION]"* ]]; then | |
CAPTURING_CHANGES=1 | |
else | |
CAPTURING_CHANGES=0 | |
fi | |
## Otherwise, add lines to the changelog if it is within the current version and not just spaces | |
elif [[ "$CAPTURING_CHANGES" == 1 ]] && [[ $line = *[!\ ]* ]]; then | |
CHANGES="$CHANGES"$'\n'"$line" | |
fi | |
done < CHANGELOG.md | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "CHANGES<<$EOF" >> "$GITHUB_ENV" | |
echo "$CHANGES" >> "$GITHUB_ENV" | |
echo "$EOF" >> "$GITHUB_ENV" | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.VERSION }} | |
name: Release ${{ env.VERSION }} | |
body: ${{ env.CHANGES }} | |
token: ${{ secrets.PAT_TOKEN }} | |
update-website: | |
name: Update website header version | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && needs.changes.outputs.version == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version | |
run: | | |
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
- name: Update html file version | |
run: | | |
curl https://api.github.com/repos/Lynx-Shortener/Website/actions/workflows/update-version.yml/dispatches -X POST -H "Authorization: Bearer ${{ secrets.PAT_TOKEN }}" -d '{"ref":"main","inputs":{"lynx_version":"${{ env.VERSION }}"}}' |