Skip to content

Merge pull request #76 from okp4/dependabot/cargo/rust/h2-0.3.26 #67

Merge pull request #76 from okp4/dependabot/cargo/rust/h2-0.3.26

Merge pull request #76 from okp4/dependabot/cargo/rust/h2-0.3.26 #67

Workflow file for this run

name: Publish
on:
push:
branches: [main]
tags: ["v*"]
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true
jobs:
matrix:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- id: set-matrix
run: echo "::set-output name=matrix::$(cat proto.json | jq -c .)"
publish-npm-package:
runs-on: ubuntu-22.04
needs: matrix
strategy:
matrix:
registry:
- url: "https://npm.pkg.github.com"
auth-token-secret: NPM_REGISTRY_TOKEN
- url: "https://registry.npmjs.org"
auth-token-secret: NPM_PUBLIC_REGISTRY_TOKEN
proto: ${{ fromJson(needs.matrix.outputs.matrix) }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up context
id: project_context
uses: FranzDiebold/github-env-vars-action@v2.8.0
- name: Configure buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- name: Generate proto
run: |
buf generate --template buf.gen.ts.yaml ${{ matrix.proto.buf }} -o ${{ matrix.proto.directory.ts }}
- name: Setup node environment (for publishing)
uses: actions/setup-node@v4
with:
node-version: 18.12
registry-url: ${{ matrix.registry.url }}
scope: "@okp4"
- name: Publish package
run: |
set -eu
yarn --cwd ${{ matrix.proto.directory.ts }} && yarn --cwd ${{ matrix.proto.directory.ts }} build
DATE=$(date +%Y%m%d%H%M%S)
publish=(yarn --cwd ${{ matrix.proto.directory.ts }} publish --access=public --no-git-tag-version --non-interactive)
if [[ $GITHUB_REF == refs/tags/v* ]]; then
publish+=(--tag latest)
else
publish+=(--prerelease --preid next.$DATE --tag next)
fi
echo "🚀 Publishing npm package with following command line: ${publish[@]}"
"${publish[@]}"
env:
NODE_AUTH_TOKEN: ${{ secrets[matrix.registry.auth-token-secret] }}
publish-crates:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.71
default: true
override: true
- name: Install cargo make
uses: davidB/rust-cargo-make@v1
- name: Configure buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- name: Generate proto
run: |
jq -c '.proto[]' proto.json | while read i; do
BUF=$(echo $i | jq -cr '.buf')
BUF_YAML=$(grep -q "cosmos/cosmos-sdk" <<< "$BUF" && echo "buf.gen.rust.cosmos.yaml" || echo "buf.gen.rust.yaml")
DIRECTORY=$(echo $i | jq -cr '.directory.rust')
buf generate --template $BUF_YAML $BUF -o $DIRECTORY
done
- name: Publish packages
working-directory: ./rust
run: |
echo "🚀 Publishing cargo package"
cargo make --env CARGO_API_TOKEN="${{ secrets.CARGO_API_TOKEN }}" -- publish
publish-pypi:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
needs: matrix
strategy:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up context
id: project_context
uses: FranzDiebold/github-env-vars-action@v2.8.0
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Python Poetry
uses: abatilo/actions-poetry@v2.4.0
with:
poetry-version: 1.4.1
- name: Configure buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- name: Generate proto
run: |
buf generate --template buf.gen.python.yaml ${{ matrix.proto.buf }} -o ${{ matrix.proto.directory.python }}
- name: Publish package
working-directory: ./${{ matrix.proto.directory.python }}/../
run: |
poetry install
poetry build
echo "🚀 Publishing pypi package '${{ matrix.proto.directory.python }}'"
poetry publish -u __token__ -p "${{ secrets.PYPI_API_TOKEN }}"