Skip to content

Commit

Permalink
testing changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
alfergus0n committed May 27, 2022
1 parent 1e7239c commit eb5281a
Show file tree
Hide file tree
Showing 9 changed files with 1,863 additions and 190 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
"changelog": "@changesets/changelog-git",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/forty-wolves-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alfergus0n/yeah": patch
---

bumping patch version for this
110 changes: 110 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Build, Test and Release

on:
push:
branches:
- main
paths-ignore:
- '**/README.md'

# ensures that only one workflow task per branch/environment will run at a time
# avoids race conditions
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
versioning:
runs-on: ubuntu-latest
outputs:
# map step output to job output
changes: ${{ steps.version.outputs.changes }}

steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# fetch all Git history, Changesets generates changelogs with correct commits
fetch-depth: 0
token: ${{secrets.GITHUB_TOKEN}}

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

# cache remains for up to 7 days after last access
- name: Building and Caching Packages
uses: actions/cache@v3
id: cache-modules
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies If node_modules Cache Not Found
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm ci

- name: Version Command
id: version
# sets steps.version.output.changes
run: |
echo ::set-output name=changes::$(npx changeset version 2>&1 | grep -q "No unreleased changesets found" && echo "false" || echo "true")
# Push updated package.json and CHANGESET.md files
- name: Push Changes
if: steps.version.outputs.changes == 'true'
run: |
git config --global user.name "Automation"
git add -A
git commit -m "Updating Versioning For Packages"
git push
echo "::set-output name=changes::false"
#git commit -m "Updating Versioning For Packages" 2>&1 >/dev/null || echo "No changes to commit"

publish:
runs-on: ubuntu-latest
# wait for versioning to complete successfully
needs: versioning
# This will only run if changeset files have been pushed
if: needs.version.outputs.changes == 'false'
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: https://npm.pkg.github.com/
scope: '@alfergus0n'
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

#TODO: install/Build/Test/Package steps here

- name: Release Packages
uses: changesets/action@v1
with:
setupGitUser: "Automation"
publish: npm run changeset-publish
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Push tags
run: git push --follow-tags

# - name: Send Slack Notification If Successful
# if: steps.changesets.outputs.published == 'true'
# # You can do something when a publish happens.
# run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"
#
# - name: fals
# if: steps.changesets.outputs.hasChangesets == 'false'
# # You can do something when a publish should happen.
# run: echo "no changesets"

# - name: tru
# if: steps.changesets.outputs.hasChangesets == 'true'
# # You can do something when a publish should happen.
# run: echo "has changesets"
17 changes: 8 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
publish:
name: Publish Package
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout Branch
uses: actions/checkout@v3
with:
# fetch all Git history, Changesets generates changelogs with correct commits
fetch-depth: 0

- name: Setup Node
Expand All @@ -37,14 +37,13 @@ jobs:
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies if node_modules cache not found
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm ci

- name: Publish Packages
run: |
git config --global user.name "Automation"
npm run publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Publish Packages
# run: |
# git config --global user.name "Automation"
# npm run publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.DS_Store
node_modules
*.log
.turbo
Loading

0 comments on commit eb5281a

Please sign in to comment.