Promote #112
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: Promote | |
on: | |
# Approximate "every 2 weeks" by doing 1st and 15th of the month. | |
schedule: | |
- cron: "0 07 01 * *" | |
- cron: "0 07 15 * *" | |
# Run it if touched | |
pull_request: | |
paths: | |
- .github/workflows/promote.yml | |
# Or manually trigger | |
workflow_dispatch: | |
inputs: | |
from: | |
description: Tag to promote from | |
required: true | |
default: dev | |
to: | |
description: Tag to promote to | |
required: true | |
default: stable | |
jobs: | |
promote: | |
runs-on: ubuntu-latest | |
steps: | |
- id: prep | |
run: | | |
case "$GITHUB_EVENT_NAME" in | |
'schedule') | |
# Promote dev to stable on the schedule | |
echo 'from=dev' | |
echo 'to=stable' | |
;; | |
'pull_request') | |
# Promote dev to itself just to test our logic | |
echo 'from=dev' | |
echo 'to=dev' | |
;; | |
'workflow_dispatch') | |
# Promote what was given | |
echo 'from=${{ inputs.from }}' | |
echo 'to=${{ inputs.to }}' | |
;; | |
*) | |
echo "Unexpected event: $GITHUB_EVENT_NAME" >&2 | |
exit 1 | |
;; | |
esac >>"$GITHUB_OUTPUT" | |
env: | |
GITHUB_EVENT_NAME: ${{ github.event_name }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # so we can find from-tag refs | |
- id: setup-demo | |
uses: restyled-io/actions/setup-demo@v4 | |
with: | |
channel: ${{ steps.prep.outputs.from }} | |
- uses: restyled-io/actions/setup@v4 | |
- uses: restyled-io/actions/run@v4 | |
with: | |
show-patch: false | |
show-patch-command: false | |
image-cleanup: true | |
manifest: ${{ steps.setup-demo.outputs.manifest }} | |
dry-run: ${{ github.event_name == 'pull_request' }} | |
paths: . | |
- name: Download ${{ steps.prep.outputs.from }} release manifest | |
run: gh release download "${{ steps.prep.outputs.from }}" -p restylers.yaml | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Update ${{ steps.prep.outputs.to }} tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ steps.prep.outputs.to }} | |
force_push_tag: true | |
commit_sha: "${{ steps.prep.outputs.from }}^{}" | |
- name: Add manifest to ${{ steps.prep.outputs.to }} release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.prep.outputs.to }} | |
files: | | |
restylers.yaml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |