Skip to content

Commit

Permalink
πŸ‘·β€β™€οΈ Build and release on Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
alecgibson committed Oct 23, 2023
1 parent 75e5150 commit 476f0bb
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 31 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
- uses: pnpm/action-setup@v2
- name: Install
run: pnpm install
- name: Publish
run: cd packages/floating-vue && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 0 additions & 28 deletions .github/workflows/release-note.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
# Use PAT instead of default Github token, because the default
# token deliberately will not trigger another workflow run
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
- uses: pnpm/action-setup@v2
- name: Install
run: pnpm install
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build
- name: Test
run: pnpm test
- name: Tag
if: ${{ github.ref == 'refs/heads/main' }}
run: ./tag.sh
6 changes: 3 additions & 3 deletions packages/floating-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "floating-vue",
"version": "2.0.0-beta.24",
"name": "@reedsy/floating-vue",
"version": "2.0.0-reedsy.1.0.0",
"description": "Easy Vue tooltips, dropdowns, menus & popovers using floating-ui",
"author": "Guillaume Chau <[email protected]>",
"scripts": {
Expand Down Expand Up @@ -75,7 +75,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/Akryum/floating-vue.git",
"url": "git+https://github.com/reedsy/floating-vue.git",
"directory": "packages/floating-vue"
}
}
26 changes: 26 additions & 0 deletions tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

VERSION=$(node -p "require('.packages/floating-vue/package.json').version")

git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --tags

VERSION_COUNT=$(git tag --list $VERSION | wc -l)

if [ $VERSION_COUNT -gt 0 ]
then
echo "Version $VERSION already deployed."
exit 0
else
echo "Deploying version $VERSION"
fi

echo '!/dist' >> .gitignore

git checkout -b release-$VERSION
git add .gitignore
git add --all dist/
git commit --message "Release version $VERSION"
git tag $VERSION
git push origin refs/tags/$VERSION

0 comments on commit 476f0bb

Please sign in to comment.