|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v[0-9]+.* |
| 7 | + |
| 8 | +# on: |
| 9 | +# push: |
| 10 | +# branches: [ sprout ] |
| 11 | +# pull_request: |
| 12 | +# branches: [ sprout ] |
| 13 | + |
| 14 | + |
| 15 | +jobs: |
| 16 | + # the create-release would be used once we want to create a specific release based on if the commit has a tag |
| 17 | + create-release: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + - uses: taiki-e/create-gh-release-action@v1 |
| 22 | + env: |
| 23 | + # (required) |
| 24 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + build: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - name: Fetch source code |
| 29 | + uses: actions/checkout@v2 |
| 30 | + # this should be with Cargo.lock files |
| 31 | + # technically, but this repo doesn't have them checked in to git |
| 32 | + - uses: actions/cache@v2 |
| 33 | + with: |
| 34 | + path: | |
| 35 | + ~/.cargo/bin/ |
| 36 | + ~/.cargo/registry/index/ |
| 37 | + ~/.cargo/registry/cache/ |
| 38 | + ~/.cargo/git/db/ |
| 39 | + .cargo/bin/ |
| 40 | + .cargo/registry/index/ |
| 41 | + .cargo/registry/cache/ |
| 42 | + .cargo/git/db/ |
| 43 | + target/ |
| 44 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} |
| 45 | + - name: Use Nix |
| 46 | + uses: cachix/install-nix-action@v16 |
| 47 | + with: |
| 48 | + nix_path: nixpkgs=channel:nixos-21.05 |
| 49 | + - name: Use Node.js ${{ matrix.node-version }} |
| 50 | + uses: actions/setup-node@v1 |
| 51 | + with: |
| 52 | + node-version: ${{ matrix.node-version }} |
| 53 | + - name: Configure Nix substituters |
| 54 | + run: | |
| 55 | + set -xe |
| 56 | + mkdir -p ~/.config/nix/ |
| 57 | + cp ./.github/nix.conf ~/.config/nix/ |
| 58 | + - uses: cachix/cachix-action@v10 |
| 59 | + with: |
| 60 | + name: ci-builds |
| 61 | + authToken: "${{ secrets.CACHIX_TOKEN }}" |
| 62 | + - name: Prepare Nix environment |
| 63 | + run: nix-shell --command "echo Completed" |
| 64 | + - name: Set up release bundle from template |
| 65 | + run: | |
| 66 | + cp -a bundles_templates/* bundles/ |
| 67 | + RELEASE="${GITHUB_REF#refs/tags/}" |
| 68 | + sed -i "s/<release-download-url>/https:\/\/github.com\/${GITHUB_REPOSITORY%/*}\/${GITHUB_REPOSITORY#*/}\/releases\/download\/${RELEASE}/g" bundles/full_suite_release_template/happ.yaml |
| 69 | + cat bundles/full_suite_release_template/happ.yaml |
| 70 | + - name: Build WASM, dnas, happs |
| 71 | + run: nix-shell --run 'npm run build:crates' |
| 72 | + - name: upload bundles |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + run: | |
| 76 | + gh release upload "${GITHUB_REF#refs/tags/}" "bundles/full_suite_release_template/hrea_suite.happ" --clobber |
| 77 | + gh release upload "${GITHUB_REF#refs/tags/}" "happs/agent/hrea_agent.dna" --clobber |
| 78 | + gh release upload "${GITHUB_REF#refs/tags/}" "happs/agreement/hrea_agreement.dna" --clobber |
| 79 | + gh release upload "${GITHUB_REF#refs/tags/}" "happs/observation/hrea_observation.dna" --clobber |
| 80 | + gh release upload "${GITHUB_REF#refs/tags/}" "happs/planning/hrea_planning.dna" --clobber |
| 81 | + gh release upload "${GITHUB_REF#refs/tags/}" "happs/proposal/hrea_proposal.dna" --clobber |
| 82 | + gh release upload "${GITHUB_REF#refs/tags/}" "happs/specification/hrea_specification.dna" --clobber |
0 commit comments