Merge pull request #1849 from Fdawgs/refactor/temp-dir #830
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: CD | |
# **What it does**: Automatically generates releases and release notes. | |
# **Why we have it**: Allows development to focus on higher value work. | |
on: | |
push: | |
branches: | |
- main | |
# Allows this workflow to be run manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release: | |
name: Create/Update Release Pull Request | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
steps: | |
- name: Release Please | |
id: release | |
# Staying on v3 due to incomplete migration guide for v4 | |
uses: google-github-actions/release-please-action@v3 | |
with: | |
changelog-types: '[ { "type": "feat", "section": "Features", "hidden": false }, { "type": "fix", "section": "Bug fixes", "hidden": false }, { "type": "build", "section": "Dependencies", "hidden": false }, { "type": "chore", "section": "Miscellaneous", "hidden": false }, { "type": "ci", "section": "Continuous integration", "hidden": false }, { "type": "perf", "section": "Improvements", "hidden": false }, { "type": "refactor", "section": "Improvements", "hidden": false }, { "type": "style", "section": "Miscellaneous", "hidden": false }, { "type": "docs", "section": "Documentation", "hidden": false }]' | |
release-type: node | |
assets: | |
name: Create and Upload Release Asset | |
needs: release | |
if: needs.release.outputs.release_created == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
check-latest: true | |
node-version: lts/* | |
- name: Install | |
run: npm ci --ignore-scripts | |
- name: Build | |
run: npm run build | |
- name: Remove dev values from package.json and package-lock.json | |
run: | | |
npm pkg delete commitlint devDependencies jest nodemonConfig scripts | |
npm pkg set scripts.start="node ." | |
npm i --ignore-scripts | |
- name: Create release asset | |
run: > | |
zip -r ${{ github.event.repository.name }}-${{ needs.release.outputs.tag_name }}.zip | |
.dockerignore .env.template .pm2.config.js | |
docker-compose.yml Dockerfile LICENSE | |
package.json package-lock.json README.md | |
dist ocr_lang_data | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./${{ github.event.repository.name }}-${{ needs.release.outputs.tag_name }}.zip | |
asset_name: ${{ github.event.repository.name }}-${{ needs.release.outputs.tag_name }}.zip | |
asset_content_type: application/zip |