Skip to content

Commit

Permalink
ci: github actions to automated build & publish
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Aug 18, 2023
1 parent 2e9806b commit 0c7c7a0
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,14 @@
# .github/dependabot.yml
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

# `npm` value will detect `pnpm` usage
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,55 @@
# .github/workflows/build_and_publish.yml

name: Build and Publish to NPM
on:
push:
branches:
- master

# by default, permissions are read-only, read + write is required for git pushes
permissions:
contents: write

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ASDF Parse
uses: kota65535/github-asdf-parse-action@v1.1.0
id: versions

- uses: actions/setup-node@v3
with:
node-version: "${{ steps.versions.outputs.nodejs }}"
registry-url: 'https://registry.npmjs.org'

- name: Build
run: npm run build

- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
version-file: "./package.json,./package-lock.json"
output-file: "CHANGELOG.md"

- name: Publish to NPM
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: npm publish
env:
# `gh secret set NPM_TOKEN --app actions --body $NPM_TOKEN`
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Github Release
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: softprops/action-gh-release@v1
with:
# output options: https://github.com/TriPSs/conventional-changelog-action#outputs
body: ${{ steps.changelog.outputs.clean_changelog }}
tag_name: ${{ steps.changelog.outputs.tag }}
22 changes: 22 additions & 0 deletions .github/workflows/repo-sync.yml
@@ -0,0 +1,22 @@
name: Sync Repo Metadata
on:
push:
branches:
- main

permissions: read-all

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Sync Repository Metadata
# uses: kbrashears5/github-action-repo-sync@v1.0.0
uses: iloveitaly/github-action-repo-sync@python
with:
TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
1 change: 1 addition & 0 deletions .tool-versions
@@ -0,0 +1 @@
nodejs 19.1.0

1 comment on commit 0c7c7a0

@iloveitaly
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunchbag this needs some tokens from your end in order to work properly, can you add these?

Please sign in to comment.