mirror of
https://github.com/fluencelabs/trust-graph
synced 2025-03-15 20:50:51 +00:00
134 lines
3.8 KiB
YAML
134 lines
3.8 KiB
YAML
name: "publish-release"
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
release:
|
|
name: "Publish"
|
|
runs-on: builder
|
|
|
|
steps:
|
|
### Setup
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set env
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "15"
|
|
registry-url: "https://registry.npmjs.org"
|
|
cache: npm
|
|
cache-dependency-path: "aqua/package-lock.json"
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
|
|
- name: Install Marine
|
|
uses: baptiste0928/cargo-install@v1.3.0
|
|
with:
|
|
crate: marine
|
|
|
|
- name: Build trust-graph
|
|
working-directory: ./service
|
|
run: ./build.sh
|
|
|
|
- name: Check Aqua compiles
|
|
working-directory: ./aqua
|
|
run: |
|
|
npm i
|
|
npm run build
|
|
|
|
- name: Create distribution package
|
|
run: |
|
|
./builtin-package/package.sh
|
|
|
|
- name: Build Changelog
|
|
id: changelog
|
|
uses: mikepenz/release-changelog-builder-action@v1
|
|
with:
|
|
configuration: ".github/workflows/changelog_config.json"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
### Publish
|
|
- name: Release to GitHub
|
|
id: release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: trust-graph ${{ env.RELEASE_VERSION }}
|
|
tag_name: ${{ env.RELEASE_VERSION }}
|
|
files: |
|
|
./trust-graph.tar.gz
|
|
body: ${{steps.changelog.outputs.changelog}}
|
|
draft: false
|
|
prerelease: false
|
|
fail_on_unmatched_files: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
### Publish Aqua API
|
|
- name: Publish Aqua API to NPM
|
|
run: |
|
|
npm version ${{ env.RELEASE_VERSION }}
|
|
npm publish --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
working-directory: ./aqua
|
|
|
|
## Update node-distro repo
|
|
- name: Calculate SHA256
|
|
run: |
|
|
du -hs trust-graph.tar.gz
|
|
echo $(sha256sum trust-graph.tar.gz)
|
|
echo "SHA256=$(sha256sum trust-graph.tar.gz | awk '{ print $1 }')" >> $GITHUB_ENV
|
|
|
|
- name: Get tar.gz URL
|
|
id: package-url
|
|
uses: actions/github-script@v4
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
result-encoding: string
|
|
script: |
|
|
try {
|
|
let assets = await github.repos.listReleaseAssets({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
release_id: "${{ steps.release.outputs.id }}",
|
|
});
|
|
console.dir(assets);
|
|
let package = assets.data.find((a) => a.name === 'trust-graph.tar.gz');
|
|
let url = package.browser_download_url;
|
|
console.log("URL: " + url);
|
|
return url;
|
|
} catch (e) {
|
|
console.log("Err: " + e);
|
|
throw e;
|
|
}
|
|
|
|
- name: Update version in node-distro repo
|
|
uses: benc-uk/workflow-dispatch@v1
|
|
with:
|
|
workflow: update_service
|
|
repo: fluencelabs/node-distro
|
|
ref: 'main'
|
|
token: ${{ secrets.PERSONAL_TOKEN }}
|
|
inputs: '{
|
|
"name": "trust-graph",
|
|
"version": "${{ env.RELEASE_VERSION }}",
|
|
"url": "${{ steps.package-url.outputs.result }}",
|
|
"sha256": "${{ env.SHA256 }}"
|
|
}'
|
|
|
|
- name: Log notice
|
|
uses: actions/github-script@v4
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
console.dir(core);
|
|
core.info("trust-graph was updated to ${{ env.RELEASE_VERSION }} in node-distro repo");
|