FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore: update GitHub Actions workflow to set permissions for contents and add npm registry URL · jaystack/functionly@7081082 · GitHub

Functionly build and publish #14

Functionly build and publish

Functionly build and publish #14

Workflow file for this run

This file contains hidden or 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: Functionly build and publish
on:
workflow_dispatch:
inputs:
version_type:
description: Version type publish
required: true
default: patch
type: choice
options:
- patch
- minor
- major
permissions:
id-token: write # Required for OIDC
contents: write # Required for pushing tags
jobs:
dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
package-manager-cache: false # never use caching in release builds
- name: Install dependencies
run: npm ci
- name: Auto Increment Version, and Publish to npmjs
run: |
git config --global user.email "jaystack-ci@jaystack.com"
git config --global user.name "jaystack-ci"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
npm version ${{ inputs.version_type }} -m "Auto-increment version: %s" --force
npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Git operations
run: |
git tag -f dev
git push -f --tags
git push
stage:
needs: dev
runs-on: ubuntu-latest
environment: stage
steps:
- uses: actions/checkout@v7
with:
ref: "refs/tags/dev"
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
package-manager-cache: false # never use caching in release builds
- name: Extract package version
id: package_version
run: echo "::set-output name=VERSION::$(jq -r .version package.json)"
shell: bash
- name: Configure Git
run: |
git config --global user.email "jaystack-ci@jaystack.com"
git config --global user.name "jaystack-ci"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Create and push git tag
run: |
git tag -f stage
git push -f --tags
- name: Publish to npm
run: npm dist-tag add functionly@${{ steps.package_version.outputs.VERSION }} stage
live:
needs: stage
runs-on: ubuntu-latest
environment: live
steps:
- uses: actions/checkout@v7
with:
ref: "refs/tags/stage"
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
package-manager-cache: false # never use caching in release builds
- name: Extract package version
id: package_version
run: echo "::set-output name=VERSION::$(jq -r .version package.json)"
shell: bash
- name: Configure Git
run: |
git config --global user.email "jaystack-ci@jaystack.com"
git config --global user.name "jaystack-ci"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Create and push git tag
run: |
git tag -f latest
git push -f --tags
- name: Publish to npm
run: npm dist-tag add functionly@${{ steps.package_version.outputs.VERSION }} latest

Back | FazBrowse Home | New Git URL