|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: {} |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "v*.*.*" |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + RUST_TOOLCHAIN: nightly-2021-12-09 |
| 12 | + NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + release-sdk: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + name: Release SDK on NPM |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + |
| 21 | + - uses: cachix/install-nix-action@v16 |
| 22 | + with: |
| 23 | + install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install |
| 24 | + install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" |
| 25 | + extra_nix_config: | |
| 26 | + experimental-features = nix-command flakes |
| 27 | + - name: Setup Cachix |
| 28 | + uses: cachix/cachix-action@v10 |
| 29 | + with: |
| 30 | + name: saber |
| 31 | + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 32 | + |
| 33 | + - name: Setup Node |
| 34 | + uses: actions/setup-node@v2 |
| 35 | + with: |
| 36 | + always-auth: true |
| 37 | + |
| 38 | + - name: Get yarn cache directory path |
| 39 | + id: yarn-cache-dir-path |
| 40 | + run: echo "::set-output name=dir::$(yarn config get cacheFolder)" |
| 41 | + - name: Yarn Cache |
| 42 | + uses: actions/cache@v2 |
| 43 | + with: |
| 44 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 45 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 46 | + restore-keys: | |
| 47 | + ${{ runner.os }}-modules- |
| 48 | +
|
| 49 | + - name: Install Yarn dependencies |
| 50 | + run: yarn install |
| 51 | + - name: Parse IDLs |
| 52 | + run: nix shell .#ci --command yarn idl:generate |
| 53 | + - run: yarn build |
| 54 | + - run: | |
| 55 | + echo 'npmAuthToken: "${NPM_AUTH_TOKEN}"' >> .yarnrc.yml |
| 56 | + - name: Publish |
| 57 | + run: yarn npm publish |
| 58 | + |
| 59 | + release-crate: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + name: Release crate on crates.io |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v2 |
| 64 | + |
| 65 | + - uses: cachix/install-nix-action@v16 |
| 66 | + with: |
| 67 | + install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install |
| 68 | + install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" |
| 69 | + extra_nix_config: | |
| 70 | + experimental-features = nix-command flakes |
| 71 | + - name: Setup Cachix |
| 72 | + uses: cachix/cachix-action@v10 |
| 73 | + with: |
| 74 | + name: saber |
| 75 | + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 76 | + |
| 77 | + - name: Install Rust nightly |
| 78 | + uses: actions-rs/toolchain@v1 |
| 79 | + with: |
| 80 | + override: true |
| 81 | + profile: minimal |
| 82 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 83 | + - uses: Swatinem/rust-cache@v1 |
| 84 | + - name: Publish crates |
| 85 | + run: nix shell .#ci --command cargo workspaces publish --from-git --yes --skip-published --token ${{ secrets.CARGO_PUBLISH_TOKEN }} |
| 86 | + |
| 87 | + release-binaries: |
| 88 | + runs-on: ubuntu-latest |
| 89 | + name: Release verifiable binaries |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v2 |
| 92 | + - uses: cachix/install-nix-action@v16 |
| 93 | + with: |
| 94 | + install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install |
| 95 | + install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" |
| 96 | + extra_nix_config: | |
| 97 | + experimental-features = nix-command flakes |
| 98 | + - name: Setup Cachix |
| 99 | + uses: cachix/cachix-action@v10 |
| 100 | + with: |
| 101 | + name: saber |
| 102 | + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 103 | + |
| 104 | + - name: Build programs |
| 105 | + run: nix shell .#ci --command anchor build --verifiable |
| 106 | + - name: Release |
| 107 | + uses: softprops/action-gh-release@v1 |
| 108 | + with: |
| 109 | + files: | |
| 110 | + target/deploy/* |
| 111 | + target/idl/* |
| 112 | + target/verifiable/* |
| 113 | +
|
| 114 | + site: |
| 115 | + runs-on: ubuntu-latest |
| 116 | + steps: |
| 117 | + - name: Checkout |
| 118 | + uses: actions/checkout@v2 |
| 119 | + |
| 120 | + - uses: cachix/install-nix-action@v16 |
| 121 | + with: |
| 122 | + install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install |
| 123 | + install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" |
| 124 | + extra_nix_config: | |
| 125 | + experimental-features = nix-command flakes |
| 126 | + - name: Setup Cachix |
| 127 | + uses: cachix/cachix-action@v10 |
| 128 | + with: |
| 129 | + name: saber |
| 130 | + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 131 | + |
| 132 | + - name: Get yarn cache directory path |
| 133 | + id: yarn-cache-dir-path |
| 134 | + run: echo "::set-output name=dir::$(yarn config get cacheFolder)" |
| 135 | + - name: Yarn Cache |
| 136 | + uses: actions/cache@v2 |
| 137 | + with: |
| 138 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 139 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 140 | + restore-keys: | |
| 141 | + ${{ runner.os }}-modules- |
| 142 | +
|
| 143 | + - name: Install Yarn dependencies |
| 144 | + run: yarn install |
| 145 | + - name: Parse IDLs |
| 146 | + run: nix shell .#ci --command yarn idl:generate |
| 147 | + - run: yarn docs:generate |
| 148 | + - run: cp -R images/ site/ |
| 149 | + |
| 150 | + - name: Deploy 🚀 |
| 151 | + |
| 152 | + with: |
| 153 | + branch: gh-pages |
| 154 | + folder: site |
0 commit comments