Skip to content

Commit

Permalink
fixed prerelease from main
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarbjorntvedt committed Dec 26, 2023
1 parent 141d4dd commit 95c0673
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 113 deletions.
107 changes: 53 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,64 @@
name: Build Package

on:
push:
branches:
- "**"
tags-ignore:
- "*.*"
push:
branches:
- '**'
tags-ignore:
- '*.*'

jobs:
build:
name: Build and test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.npm.outputs.version }}
prerelease: ${{ steps.npm.outputs.prerelease }}
is_prerelease: ${{ steps.npm.outputs.is_prerelease }}
deploy: ${{ steps.npm.outputs.deploy }}
build:
name: Build and test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.npm.outputs.version }}
prerelease: ${{ steps.npm.outputs.prerelease }}
is_prerelease: ${{ steps.npm.outputs.is_prerelease }}
deploy: ${{ steps.npm.outputs.deploy }}

steps:
- name: Install, build and test
uses: tfso/action-helpers/npm-build@v1
id: npm
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_GLOBAL_TOKEN: ${{ secrets.TFSO_REPO_READ }}
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}
TRUNCATE_PRERELEASE: true
NODE_VERSION: 18
steps:
- name: Install, build and test
uses: tfso/action-helpers/npm-build@v1
id: npm
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_GLOBAL_TOKEN: ${{ secrets.TFSO_REPO_READ }}
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}
TRUNCATE_PRERELEASE: true
NODE_VERSION: 18

- name: upload artifact (from content in ./dist folder)
uses: actions/upload-artifact@v3
with:
name: artifact
path: ./dist
- name: upload artifact (from content in ./dist folder)
uses: actions/upload-artifact@v3
with:
name: artifact
path: ./dist

publish:
name: publish prerelease
if: ${{ needs.build.outputs.deploy == 'true' }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
publish:
name: publish prerelease
if: ${{ needs.build.outputs.deploy == 'true' }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: download artifact
uses: actions/download-artifact@v3
with:
name: artifact
steps:
- name: download artifact
uses: actions/download-artifact@v3
with:
name: artifact

- name: setup
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
scope: "@tfso"

- name: Publish prerelease to Npm
run: |
npm version prerelease --preid=${{github.ref_name}}-${{github.run_number}} --no-git-tag-version
npm publish --verbose --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: setup
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
scope: '@tfso'

- name: Publish prerelease to Npm
run: |
npm version prerelease --preid=${{github.ref_name}}-${{github.run_number}} --no-git-tag-version
npm publish --verbose --tag dev --no-tag
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118 changes: 59 additions & 59 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,73 +16,73 @@
name: Release Package

on:
release:
types: [published]
release:
types: [published]

jobs:
build:
name: build release
runs-on: ubuntu-latest
if: github.event.release.draft == false && github.event.release.prerelease == false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
build:
name: build release
runs-on: ubuntu-latest
if: github.event.release.draft == false && github.event.release.prerelease == false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: npm access token
run: |
npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc
npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}
- name: npm access token
run: |
npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc
npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}

- name: Update package.json and CHANGELOG.md
run: |
git config --global user.name '${{github.actor}}'
git config --global user.email '${{github.actor}}@users.noreply.github.com'
npm version ${{github.event.release.tag_name}} --no-git-tag-version
npx auto-changelog -p && git add CHANGELOG.md
git add package.json
git commit -m "Update package.json version to ${{github.event.release.tag_name}} "
git push origin HEAD:${{github.event.release.target_commitish}}
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Update package.json and CHANGELOG.md
run: |
git config --global user.name '${{github.actor}}'
git config --global user.email '${{github.actor}}@users.noreply.github.com'
npm version ${{github.event.release.tag_name}} --no-git-tag-version
npx auto-changelog -p && git add CHANGELOG.md
git add package.json
git commit -m "Update package.json version to ${{github.event.release.tag_name}} "
git push origin HEAD:${{github.event.release.target_commitish}}
- uses: actions/setup-node@v4
with:
node-version: 18

- name: install project
run: npm ci
- name: install project
run: npm ci

- name: build project
run: npm run build
- name: build project
run: npm run build

- name: upload artifact (from content in ./dist folder)
uses: actions/upload-artifact@v3
with:
name: artifact
path: ./dist
- name: upload artifact (from content in ./dist folder)
uses: actions/upload-artifact@v3
with:
name: artifact
path: ./dist

publish:
name: publish release
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
publish:
name: publish release
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: download artifact
uses: actions/download-artifact@v3
with:
name: artifact
steps:
- name: download artifact
uses: actions/download-artifact@v3
with:
name: artifact

- name: setup
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
scope: "@tfso"
- name: setup
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
scope: '@tfso'

- name: Publish release to Npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Publish release to Npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 95c0673

Please sign in to comment.