Skip to content
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
67 changes: 66 additions & 1 deletion .github/workflows/continuous-build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
########################################################################################
# The following secrets are required:
#
# 1. GH_ACCESS_TOKEN - A "fine-grained personal access token" generated through the
# Github UI. It seems like these tokens are scoped to a user, rather than an
# organisation.
#
# The following minimum permissions are required:
# Read - access to metadata
# Read & write - access to actions and code
# 2. GH_USER_NAME - The name (not username) associated with the Git user. e.g. John Smith
# 3. GH_USER_EMAIL - The email associated with the Git user
# 4. NPM_TOKEN - A token for publishing to npm
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I have released https://www.npmjs.com/package/@api3/data-feed-proxy-combinators because I needed some version to be released to be able to create the NPM_TOKEN secret.

########################################################################################
name: Continuous build

on:
Expand Down Expand Up @@ -32,9 +46,60 @@ jobs:

- name: Build
run: pnpm build

- name: Verify vendor contracts
run: pnpm verify-vendor-contracts

- name: Test
run: pnpm test

tag-and-release:
runs-on: ubuntu-latest
# Only tag and release on pushes to main (or the release branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Clone @api3/data-feed-proxy-combinators
uses: actions/checkout@v5

- name: Set up pnpm
uses: pnpm/action-setup@v3

- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: '20.17.0'
cache: 'pnpm'

# TODO: Are these necessary?
# - name: Configure Git credentials
# run: |
# git config --global user.name '${{ secrets.GH_USER_NAME }}'
# git config --global user.email '${{ secrets.GH_USER_EMAIL }}'

- name: Install Dependencies
run: pnpm install

- name: Build
run: pnpm run build

- name: Get package.json version
id: get-version
run: echo "version=$(cat package.json | jq -r '.version' | sed 's/^/v/')" >> $GITHUB_OUTPUT

- name: Validate tag
id: validate-tag
run: test "$(git tag -l '${{ steps.get-version.outputs.version }}' | awk '{print $NF}')" = "${{ steps.get-version.outputs.version }}" || echo "new-tag=true" >> $GITHUB_OUTPUT

- name: Tag and release on Github
if: ${{ steps.validate-tag.outputs.new-tag }}
run: pnpm run release:tag
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Publish to npm
if: ${{ steps.validate-tag.outputs.new-tag }}
run: |
npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
pnpm publish --access public
env:
NPM_CONFIG_PROVENANCE: true
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"oev"
],
"license": "MIT",
"version": "0.0.1",
"version": "0.1.0",
"repository": {
"type": "git",
"url": "https://github.com/api3dao/data-feed-proxy-combinators.git"
Expand All @@ -25,23 +25,25 @@
".": "./dist/src/index.js"
},
"scripts": {
"build": "pnpm build:hardhat && tsc -p tsconfig.build.json",
"build:hardhat": "hardhat --config hardhat.build.config.ts compile",
"build": "pnpm build:hardhat && tsc -p tsconfig.build.json",
"coverage": "hardhat coverage",
"deploy:InverseApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags InverseApi3ReaderProxyV1",
"deploy:NormalizedApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags NormalizedApi3ReaderProxyV1",
"deploy:ProductApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags ProductApi3ReaderProxyV1",
"deploy:PriceCappedApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags PriceCappedApi3ReaderProxyV1",
"deploy:ProductApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags ProductApi3ReaderProxyV1",
"deploy:ScaledApi3FeedProxyV1": "hardhat deploy --network $NETWORK --tags ScaledApi3FeedProxyV1",
"lint": "pnpm run prettier:check && pnpm run lint:eslint && pnpm run lint:solhint",
"lint:solhint": "solhint ./contracts/**/*.sol",
"lint:eslint": "eslint . --ext .js,.ts",
"lint:solhint": "solhint ./contracts/**/*.sol",
"lint": "pnpm run prettier:check && pnpm run lint:eslint && pnpm run lint:solhint",
"prettier:check": "prettier --check \"./**/*.{js,ts,md,json,sol}\"",
"prettier": "prettier --write \"./**/*.{js,ts,md,json,sol}\"",
"verify-vendor-contracts": "hardhat run scripts/verify-vendor-contracts.ts",
"test": "hardhat test --parallel"
"release:tag": "ts-node scripts/tag-and-release.ts",
"test": "hardhat test --parallel",
"verify-vendor-contracts": "hardhat run scripts/verify-vendor-contracts.ts"
},
"devDependencies": {
"@api3/commons": "^1.0.1",
"@api3/contracts": "^30.0.0",
"@api3/eslint-plugin-commons": "^3.0.0",
"@api3/promise-utils": "^0.4.0",
Expand Down
Loading
Loading