Skip to content

Commit

Permalink
👷‍♀️ Automated publish
Browse files Browse the repository at this point in the history
  • Loading branch information
alecgibson committed Sep 1, 2023
1 parent 8956c43 commit 03bed24
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 8,351 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/ci.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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'
- name: Install
# Skip post-install to avoid malicious scripts stealing PAT
run: npm install --ignore-script
env:
# GITHUB_TOKEN can't access packages hosted in private repos,
# even within the same organisation
NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Post-install
run: npm rebuild && npm run prepare --if-present
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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: '16.x'
registry-url: 'https://npm.pkg.github.com'
- name: Install
# Skip post-install to avoid malicious scripts stealing PAT
run: npm install --ignore-script
env:
# GITHUB_TOKEN can't access packages hosted in private repos,
# even within the same organisation
NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Post-install
run: npm rebuild && npm run prepare --if-present
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Tag
if: ${{ github.ref == 'refs/heads/main' }}
run: ./tag.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*.log
.DS_Store
node_modules
package-lock.json
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reedsy/vuex",
"version": "4.1.1",
"version": "4.1.2",
"description": "state management for Vue.js",
"main": "dist/vuex.cjs.js",
"exports": {
Expand Down Expand Up @@ -74,14 +74,15 @@
"cross-env": "^7.0.3",
"css-loader": "^2.1.0",
"enquirer": "^2.3.6",
"eslint": "^7.32.0",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^9.17.0",
"eslint-plugin-vue-libs": "^4.0.0",
"execa": "^5.0.0",
"express": "^4.18.2",
"fs-extra": "^10.1.0",
"jest": "^29.2.0",
"jest-environment-jsdom": "^29.2.0",
"puppeteer": "^19.0.0",
"puppeteer": "=19.0.0",
"regenerator-runtime": "^0.13.5",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
Expand Down
121 changes: 0 additions & 121 deletions scripts/release.js

This file was deleted.

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('./package.json').version")

git config --local user.email "github@reedsy.com"
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 03bed24

Please sign in to comment.