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

Add CI for publish and version checks. #41

Merged
merged 11 commits into from
Aug 21, 2023
Merged
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
13 changes: 0 additions & 13 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ jobs:
- run: yarn build
- run: yarn lint
- run: yarn test
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty after building"
exit 1
fi
# - name: Validate RC changelog
# if: ${{ startsWith(github.head_ref, 'release/') }}
# run: yarn auto-changelog validate --rc
# - name: Validate changelog
# if: ${{ !startsWith(github.head_ref, 'release/') }}
# run: yarn auto-changelog validate
all-jobs-pass:
name: All jobs pass
runs-on: ubuntu-20.04
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/check-package-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check Package Version in PR

on:
pull_request:
branches:
- main
paths:
- 'packages/snap/src/**'

jobs:
check_version:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'create-main-branch'
run: 'git branch --track main origin/main'

- name: Get version from main branch
id: get_version_main
run: echo "::set-output name=version::$(git show HEAD~1:package.json | grep '"version":' | cut -d '"' -f 4)"

- name: Get version from PR branch
id: get_version_pr
run: echo "::set-output name=version::$(grep '"version":' package.json | cut -d '"' -f 4)"

- name: Compare versions and prevent merging if the same
run: |
if [ "${{ steps.get_version_main.outputs.version }}" == "${{ steps.get_version_pr.outputs.version }}" ]; then
echo "Error: Versions in main branch and PR are the same - please upgrade version in PR."
exit 1
else
echo "Versions are different, allowing merge"
echo "::set-output name=version_changed::true"
fi
18 changes: 18 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'NPM Publish'
on:
release:
types: [published]

jobs:
NPM-Publish:
permissions:
contents: read
id-token: write

uses: celo-org/reusable-workflows/.github/workflows/[email protected]
with:
node-version: 16
package-dir: 'packages/snap'
akeyless-api-gateway: https://api.gateway.akeyless.celo-networks-dev.org
akeyless-github-access-id: p-kf9vjzruht6l
akeyless-token-path: /static-secrets/apps-tooling-circle/npm-publish-token
montera82 marked this conversation as resolved.
Show resolved Hide resolved
48 changes: 0 additions & 48 deletions .github/workflows/publish-release.yml

This file was deleted.

14 changes: 8 additions & 6 deletions packages/snap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,17 @@ This example shows how one can use the snap to send a more generic transaction.

## Publishing a new version of the Snap.

In other to update the snap to publish a new change, Update the `version` tag in both `packages/snap/snap.config.js` and `packages/snap/package.json` to the same. Then from you console run the following commands.
In other to update the snap to publish a new change, Update the `version` tag in both `packages/snap/snap.config.js` and `packages/snap/package.json` to the same.

Note: You must be logged into NPM on your terminal as well as added to the celo organization on npm.
Next create a new Release:
You can do this by going to the "Releases" tab, then clicking the "Create a new release" button.

```
cd packages/snap
Tag version: Specify the version number, such as v1.0.0 ( keep this consistent with those above )
Release title: Provide a descriptive title for the release.
Describe the release: Add any release notes, changelog information, or details about what's included in this release.
Choose "Publish release" to create the release.

npm publish --access public
```
Action should automatically trigger the job.

## Register a new coin type.

Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/celo-org/gas-snap.git"
},
"source": {
"shasum": "Aglj//sQdE+aaLIrYZNEA9WcyK0iWd3JH+JGANbCXRQ=",
"shasum": "qtNAWkvYCxePERSEL6GonjUNmE7wikQoIhfnnJMYJQo=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Loading