Skip to content

fix: 2024: ロゴのXMLエラーを修正 #165

fix: 2024: ロゴのXMLエラーを修正

fix: 2024: ロゴのXMLエラーを修正 #165

name: Deploy Preview to Firebase Hosting
on:
pull_request:
branches:
- master
types:
- opened
- synchronize
env:
NODE_VERSION: 20
PREVIEW_EXPIRES: 7d
WORKING_DIRECTORY: "2024"
jobs:
build:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4
# https://github.com/actions/setup-node
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/package-lock.json
- name: npm ci
run: npm ci --production
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: npm run build
run: npm run build
working-directory: ${{ env.WORKING_DIRECTORY }}
# https://github.com/actions/upload-artifact
- uses: actions/upload-artifact@v4
with:
name: public_${{ github.sha }}
path: ${{ env.WORKING_DIRECTORY }}/public/*
retention-days: 1
lint:
runs-on: ubuntu-latest
needs:
- build
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4
# https://github.com/actions/setup-node
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/package-lock.json
# https://github.com/actions/download-artifact
- uses: actions/download-artifact@v4
with:
name: public_${{ github.sha }}
path: ${{ env.WORKING_DIRECTORY }}/public
- name: npm ci
run: npm ci
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: npm run lint
run: npm run lint
working-directory: ${{ env.WORKING_DIRECTORY }}
deploy:
runs-on: ubuntu-latest
needs:
- lint
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4
# https://github.com/actions/setup-node
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/package-lock.json
# https://github.com/actions/download-artifact
- uses: actions/download-artifact@v4
with:
name: public_${{ github.sha }}
path: ${{ env.WORKING_DIRECTORY }}/public
# https://github.com/google-github-actions/auth
- uses: google-github-actions/auth@v2
with:
create_credentials_file: true
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: npm install
run: npm install -g firebase-tools@$(node -p -e "require('./${{ env.WORKING_DIRECTORY }}/package.json').devDependencies['firebase-tools']")
- name: firebase hosting:channel:create
run: |
channel=$(echo ${{ github.head_ref }} | tr _ -)
firebase hosting:channel:create ${channel}
continue-on-error: true
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: firebase hosting:channel:open
id: firebase_hosting_channel_open
run: |
channel=$(echo ${{ github.head_ref }} | tr _ -)
url=$(firebase hosting:channel:open ${channel} | awk '{ print $3 }')
echo "url=${url}" >> ${GITHUB_OUTPUT}
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: sed
env:
URL: ${{ steps.firebase_hosting_channel_open.outputs.url }}
run: sed -i -e "s|https://ntt-developers.github.io/ntt-tech-conference/${{ env.WORKING_DIRECTORY }}|${URL}|g" public/index.html
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: firebase hosting:channel:deploy
run: |
channel=$(echo ${{ github.head_ref }} | tr _ -)
firebase hosting:channel:deploy -e ${{ env.PREVIEW_EXPIRES }} ${channel}
working-directory: ${{ env.WORKING_DIRECTORY }}
notify:
runs-on: ubuntu-latest
needs:
- deploy
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4
# https://github.com/actions/setup-node
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/package-lock.json
# https://github.com/google-github-actions/auth
- uses: google-github-actions/auth@v2
with:
create_credentials_file: true
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: npm install
run: npm install -g firebase-tools@$(node -p -e "require('./package.json').devDependencies['firebase-tools']")
- name: firebase hosting:channel:open
id: firebase_hosting_channel_open
run: |
channel=$(echo ${{ github.head_ref }} | tr _ -)
url=$(firebase hosting:channel:open ${channel} | awk '{ print $3 }')
echo "url=${url}" >> ${GITHUB_OUTPUT}
working-directory: ${{ env.WORKING_DIRECTORY }}
# https://github.com/actions/github-script
- uses: actions/github-script@v7
env:
URL: ${{ steps.firebase_hosting_channel_open.outputs.url }}
with:
script: |
const body = `Preview: ${process.env.URL}`
const options = github.rest.issues.listComments.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
})
const comments = await github.paginate(options)
const comment = comments.find(c => c.body == body)
if (comment) {
return
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
})