Publish to Snapcraft #1
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
# This workflow will run tests using node and then publish a package to Snapcraft when a release is created | |
name: Publish to Snapcraft | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
permissions: | |
issues: read | |
pull-requests: read | |
actions: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- run: npm ci | |
name: Install dependencies | |
- run: npm run build -w packages/notification | |
- run: npm test | |
name: Run tests | |
- run: npm pack | |
name: Pack using npm pack | |
- run: npm install -g ./hyperjumptech-monika-*.tgz | |
name: Install the packed npm package | |
- run: npm run prod_test | |
name: Run production test | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- run: npm ci --workspaces --if-present | |
name: Install workspaces dependencies | |
- run: npm run build --workspaces --if-present | |
name: Build workspaces | |
- run: npm ci | |
name: Install dependencies | |
- run: sed -i 's#packages/notification/hyperjumptech-monika-notification#../../packages/notification/hyperjumptech-monika-notification#g' package.json | |
name: Change monika notification package path | |
- run: npm run pack-tarballs | |
name: Pack as tarball | |
- run: mv dist/monika*.tar.gz . | |
name: Move the tarball from dist folder to root | |
- run: mv monika*.tar.gz monika.tar.gz | |
name: Rename tarball | |
- uses: snapcore/action-build@v1 | |
id: snapcraft | |
name: Build Snap package | |
- uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | |
with: | |
snap: ${{ steps.snapcraft.outputs.snap }} | |
release: edge |