137 lines
4.5 KiB
YAML
137 lines
4.5 KiB
YAML
name: Development run
|
|
|
|
# Requires mocking the "public" event to begin this workflow and avoid actual runs
|
|
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
|
|
on:
|
|
public:
|
|
|
|
jobs:
|
|
run:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout action
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Setup the Node runtime for this project
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
node-version-file: .nvmrc
|
|
- name: Install dependencies
|
|
run: npm install
|
|
- name: Package the build
|
|
run: npm run build
|
|
- name: Start a workflow with a webhook trigger
|
|
id: wfb
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
webhook: ${{ secrets.SLACK_WEBHOOK_TRIGGER }}
|
|
webhook-type: webhook-trigger
|
|
payload: |
|
|
author: ${{ github.event.sender.login }}
|
|
channel_id: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
event_url: ${{ github.event.pull_request.html_url }}
|
|
repo_name: ${{ github.event.repository.full_name }}
|
|
status: ${{ job.status }}
|
|
- name: Post a token message into channel
|
|
id: api
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
method: chat.postMessage
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
text: ":checkered_flag: Action happens at <https://github.com/${{ github.repository }}>"
|
|
- name: Initiate the deployment sequence
|
|
id: slack
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
method: chat.postMessage
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
text: ":eyes: Testing started..."
|
|
attachments:
|
|
- color: "dbab09"
|
|
fields:
|
|
- title: "Status"
|
|
short: true
|
|
value: "In Progress"
|
|
- name: Write starting statistics
|
|
id: stats
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
method: chat.postMessage
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ steps.slack.outputs.channel_id }}
|
|
text: "Started at `${{ steps.slack.outputs.time }}`"
|
|
thread_ts: "${{ steps.slack.outputs.ts }}"
|
|
- name: Countdown
|
|
run: sleep 3
|
|
- name: Launch time is now
|
|
id: finished
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
method: chat.update
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
ts: "${{ steps.slack.outputs.ts }}"
|
|
text: ":microscope: Testing finished!"
|
|
attachments:
|
|
- color: "28a745"
|
|
fields:
|
|
- title: "Status"
|
|
short: true
|
|
value: "Completed"
|
|
- name: Include ending statistics
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
method: chat.postMessage
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ steps.slack.outputs.channel_id }}
|
|
text: "Finished at `${{ steps.finished.outputs.time }}`"
|
|
thread_ts: "${{ steps.stats.outputs.thread_ts }}"
|
|
- name: Celebrate wins
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
method: reactions.add
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
timestamp: ${{ steps.slack.outputs.ts }}
|
|
name: "eye-in-speech-bubble"
|
|
- name: Upload this workflow file
|
|
id: file
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
method: files.uploadV2
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel_id: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
initial_comment: ":robot_face: The codes exists here"
|
|
file: .github/workflows/develop.yml
|
|
filename: action.yml
|
|
- name: Write one final webhook
|
|
uses: ./
|
|
with:
|
|
errors: true
|
|
webhook: ${{ secrets.SLACK_INCOMING_WEBHOOK }}
|
|
webhook-type: incoming-webhook
|
|
payload: |
|
|
text: "end."
|