Skip to content

update

update #387

Workflow file for this run

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: |
repo_age=$(( $(date -u +"%Y") - $(curl -s -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }} | jq -r .created_at | cut -c 1-4) ))
repo_version=$(date +'%Y.%-j').$((`date +%s` % 86400 ))
echo "release_tag=$repo_age$repo_version" >> $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: 1
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: 1
keep_minimum_runs: 0
needs: [release, purge, close-issues, release-cleanup]