Skip to content

update event name

update event name #21

name: Release and Changelog
#on:
# workflow_dispatch:
# push:
# tags:
# # a prerelease noted by a hyphen will not trigger
# - 'lantern-[0-9]+.[0-9]+.[0-9]+'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Check if release already exists
id: exists
env:
GH_TOKEN: ${{ github.token }}
run: |
echo EXISTING=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/releases \
| jq -r '.[].tag_name' | grep -c "${{ github.ref_name }}") >> "$GITHUB_OUTPUT"
- name: Create release if none exists
if: ${{ steps.exists.outputs.EXISTING < 1 }}
env:
GH_TOKEN: ${{ github.token }}
# https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release
run: |
gh api -i \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/releases \
-f tag_name='${{ github.ref_name }}' \
-f name='Release ${{ github.ref_name }}' \
-f body='🤖 Autogenerated changelog for ${{ github.repository }} ${{ github.ref_name }}' \
-F draft=false \
-F prerelease=false \
-F generate_release_notes=true
- name: Strip repository name of owner
if: ${{ steps.exists.outputs.EXISTING < 1 }}
id: repo
run: |
echo "REPO_NAME=$(echo ${{ github.repository }} | sed s/'${{ github.repository_owner }}\/'//g)" >> "$GITHUB_OUTPUT"
- name: Send Slack message to Releases channel
if: ${{ steps.exists.outputs.EXISTING < 1 }}
run: |
curl -X POST -H 'Content-type: application/json' \
--data "{\"platform\": \"${{ steps.repo.outputs.REPO_NAME }}\", \"version\": \"${{ github.ref_name }}\"}" \
${{ secrets.SLACK_RELEASES_WEBHOOK }}
- name: Trigger QC Checklist in customer-service repo
if: ${{ steps.exists.outputs.EXISTING < 1 }}
env:
GH_GRANTS_TOKEN: ${{ secrets.GH_GRANTS_TOKEN }}
run: |
echo "Sending QC Checklist trigger for ${{ steps.repo.outputs.REPO_NAME }} ${{ github.ref_name }}"
curl -i -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token $GH_GRANTS_TOKEN" \
--request POST --data '{"event_type": "TRIGGER_QC_CHECKLIST", "client_payload": { "platform": "${{ steps.repo.outputs.REPO_NAME }}", "version": "${{ github.ref_name }}"}}' \
https://api.github.com/repos/getlantern/customer-support/dispatches