release #302
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: | |
push: | |
branches: | |
- main | |
permissions: | |
actions: write | |
contents: write | |
issues: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'release') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Generate release tag | |
run: echo "release_tag=$(date +'%Y.%j').$((`date +%s` % 86400 ))" >> $GITHUB_ENV | |
- name: Generate issue list | |
run: echo "issue_list=$(gh issue list -l fixed-pending-release | cut -f1 | sed 's/^/#/' | sed 's/$/ /' | tr -d '\n\t\r')" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
GH_REPO: ${{ github.repository }} | |
- name: Create release | |
uses: ncipollo/[email protected] | |
with: | |
tag: ${{ env.release_tag }} | |
name: ${{ env.release_tag }} | |
body: ${{ env.issue_list }} | |
purge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine URLs to purge | |
id: purge_urls | |
run: | | |
baseUrl="https://cdn.jsdelivr.net/gh/${{ github.repository }}@latest" | |
urls="" | |
for f in `find adblock controld dnsmasq domains hosts ips pac rpz wildcard -name "*.txt" -o -name "*.pac" -o -name "*.json" -type f`; do | |
urls+="${baseUrl}/${f}," | |
done | |
echo "urls=${urls%,*}" >> $GITHUB_OUTPUT | |
- name: Purge CDN cache | |
uses: egad13/[email protected] | |
with: | |
url: ${{ steps.purge_urls.outputs.urls }} | |
needs: release | |
close-issues: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Comment and close fixed issues | |
uses: gcampbell-msft/fixed-pending-release@main | |
with: | |
token: ${{ github.token }} | |
label: fixed-pending-release | |
removeLabel: true | |
applyToAll: true | |
message: "This issue has been fixed in release [${releaseTag}](${releaseUrl})" | |
needs: [release, purge] | |
release-cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete old releases | |
uses: sgpublic/[email protected] | |
with: | |
release-drop: true | |
release-keep-count: 3 | |
release-drop-tag: true | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
needs: [release, purge] | |
workflow-cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete old workflow runs | |
uses: Mattraks/[email protected] | |
with: | |
token: ${{ github.token }} | |
repository: ${{ github.repository }} | |
retain_days: 2 | |
keep_minimum_runs: 0 | |
needs: [release, purge, close-issues, release-cleanup] |