Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify publishing package #56

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 22 additions & 83 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Release CI
name: Release @agoric/synpress

on:
push:
branches: [master]
workflow_dispatch:
inputs:
version:
Expand All @@ -16,98 +14,39 @@ concurrency:

jobs:
release:
name: Publish to npm
runs-on: ubuntu-latest
name: release

container:
image: synthetixio/docker-node:18.16-ubuntu

steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v2
with:
fetch-depth: 0
ref: master

- name: Set pnpm cache directory
run: pnpm config set store-dir .pnpm-store
continue-on-error: true
- name: Checkout code
uses: actions/checkout@v4

- name: Setup cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # pin@v2
- name: Set up Node.js
uses: actions/setup-node@v4
with:
path: |
.pnpm-store
node_modules
key: ${{ runner.os }}-pnpm-v1-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-v1-
continue-on-error: true
node-version: 18

# fixes permission issues on docker
- name: Chown workspace
run: chown -R $(whoami) .

- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline

- name: Set git config
run: |
git config user.name $GIT_USER
git config user.email $GIT_EMAIL
mkdir -p ~/.gnupg/
printf $GPG_KEY | base64 -d > ~/.gnupg/private.key
gpg --import ~/.gnupg/private.key
git config commit.gpgsign true
git config user.signingkey $GIT_SIGNING_KEY
env:
GIT_USER: ${{ secrets.GIT_USER }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GIT_SIGNING_KEY: ${{ secrets.GIT_SIGNING_KEY }}

- name: Set pnpm config
run: pnpm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
- name: Authenticate with npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Set current pnpm package version
id: extract-version
run: |
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
echo ::set-output name=current-version::$PACKAGE_VERSION
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

- name: Release ${{ github.event.inputs.version }}
if: github.event_name == 'workflow_dispatch'
run: |
git reset --hard
pnpm release:${{ github.event.inputs.version }} --ci
pnpm publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_USER: ${{ secrets.GIT_USER }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GIT_SIGNING_KEY: ${{ secrets.GIT_SIGNING_KEY }}
- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline

- name: Release patch:beta
if: github.event_name == 'push'
- name: Configure Git
run: |
git reset --hard
git config --global user.name "${{ secrets.GIT_USER }}"
git config --global user.email "${{ secrets.GIT_EMAIL }}"

echo ${{ steps.extract-version.outputs.current-version }}
if echo ${{ steps.extract-version.outputs.current-version }} | grep -q "beta"; then
pnpm release --ci --preRelease
pnpm publish
else
pnpm release:patch --ci --preRelease=beta
pnpm publish
fi
- name: Release with release-it
run: npx release-it --increment ${{ github.event.inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_EMAIL }}
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_USER: ${{ secrets.GIT_USER }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GIT_SIGNING_KEY: ${{ secrets.GIT_SIGNING_KEY }}
14 changes: 0 additions & 14 deletions .release-it.json

This file was deleted.

13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agoric/synpress",
"version": "3.8.3-beta.2",
"version": "3.8.3",
"description": "Synpress is e2e testing framework based around Cypress.io & playwright with included MetaMask support. Test your dapps with ease.",
"keywords": [
"Synpress",
Expand Down Expand Up @@ -34,6 +34,17 @@
"prettier --write --ignore-unknown"
]
},
"release-it": {
"git": {
"commitMessage": "release: v${version}",
"tagName": "${version}",
"tagAnnotation": "Release v${version}",
"push": true
},
"github": {
"release": true
}
},
"scripts": {
"fix": "turbo fix:eslint fix:prettier --concurrency 1",
"fix:eslint": "eslint . --ext .js,.ts,.jsx,.tsx --fix",
Expand Down