Refactor: GitHub Actions과정을 최적화한다 #2
Workflow file for this run
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: CICD Extension | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
permissions: | |
contents: write | |
jobs: | |
build-extension: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: pnpm | |
- name: pnpm install | |
run: pnpm install --frozen-lockfile --prefer-offline | |
- name: setting environment variables | |
run: | | |
echo "${{ secrets.SHARED_ENV_FILE }}" >> packages/shared/.env | |
echo WEB_URL=${{ secrets.PROD_WEB_URL }} >> packages/shared/.env | |
- name: build | |
run: pnpm run build:extension | |
- name: Zip the build files | |
run: pnpm run zip | |
- name: Upload Extension | |
uses: actions/upload-artifact@v4 | |
with: | |
name: extension | |
path: dist-zip/extension.zip | |
upload-extension: | |
needs: build-extension | |
runs-on: ubuntu-22.04 | |
# 수동 배포를 위해 `v.xx` 태그로 익스텐션 배포를 진행한다. | |
if: ${{ startsWith(github.ref, 'refs/tags/v.')}} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
- name: Upload zipped file on chrome store | |
uses: mnao305/[email protected] | |
with: | |
file-path: extension/extension.zip | |
extension-id: eaiojpmgklfngpjddhoalgcpkepgkclh | |
client-id: ${{ secrets.CLIENT_ID }} | |
client-secret: ${{ secrets.CLIENT_SECRET }} | |
refresh-token: ${{ secrets.REFRESH_TOKEN }} | |
publish: false | |
- name: Update gitHub releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
run: | | |
gh release create "$tag" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ | |
--generate-notes |