Skip to content

Publish

Publish #16

Workflow file for this run

name: Publish
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
container: rust:1.77
services:
consul:
image: consul:1.11.11
env:
# We pass the config as a JSON here to simulate one service with 3 nodes.
# TODO: Ideally, we should use the same setup in local environment (`testdata/config.hcl`) in GHA test.
CONSUL_LOCAL_CONFIG: '{"acl": [{"default_policy": "allow", "enable_token_persistence": true, "enabled": true}], "services": [ {"address": "1.1.1.1", "checks": [], "id": "test-service-1", "name": "test-service", "port": 20001}, {"address": "2.2.2.2", "checks": [], "id": "test-service-2", "name": "test-service", "port": 20002}, {"address": "3.3.3.3", "checks": [], "id": "test-service-3", "name": "test-service", "port": 20003} ]}'
env:
CONSUL_HTTP_ADDR: http://consul:8500
steps:
- uses: actions/checkout@v2
- name: Test
run: cargo test
dry-run:
runs-on: ubuntu-latest
container: rust:1.77
steps:
- uses: actions/checkout@v2
- name: Publish Dry Run
run: cargo publish --dry-run
publish:
needs: [test, dry-run]
runs-on: ubuntu-latest
container: rust:1.74
environment: crates-publish
steps:
- uses: actions/checkout@v2
- name: Publish to Crates.io
run: cargo publish --token ${{ secrets.CARGO_PUBLISH_TOKEN_SFONG }}