v0.5.6 #52
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI - Build release asset | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| name: Build OTP ${{ matrix.otp }} | Elixir ${{ matrix.elixir }} | Node ${{ matrix.node }} | OS ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: ['ubuntu-24.04'] | |
| otp: ['26.2.5'] | |
| elixir: ['1.14.5'] | |
| node: ['18.20.8'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set RELEASE_TAG env | |
| run: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV | |
| - name: Update VERSION file with '${GITHUB_REF:10}' | |
| run: echo -n "${GITHUB_REF:11}" > VERSION | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ matrix.otp }} | |
| elixir-version: ${{ matrix.elixir }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: | | |
| mix local.rebar --force | |
| mix local.hex --force | |
| mix archive.install hex phx_new | |
| mix deps.get | |
| npm install | |
| - name: Check code format | |
| run: mix format --check-formatted | |
| - name: Run tests | |
| run: mix test | |
| - name: Run dialyzer | |
| run: mix dialyzer --force-check --format dialyxir | |
| - name: Build release | |
| run: | | |
| export SECRET_KEY_BASE=$(MIX_ENV=test mix phx.gen.secret) | |
| mix compile | |
| npm run deploy | |
| mix phx.digest | |
| mix release | |
| env: | |
| MIX_ENV: prod | |
| - name: Build package | |
| id: build_package | |
| run: | | |
| timestamp="`date '+%Y%m%d-%H%M%S'`" | |
| version="$timestamp-`echo $REVISION | cut -c1-8 `" | |
| apppath="$RELEASE_PATH/$APPLICATION" | |
| archive="$APPLICATION-$version.tar.gz" | |
| cp cooperatives.yml $apppath/ | |
| echo "$RELEASE_TAG" > $apppath/TAG | |
| echo "$REVISION @ $REF" > $apppath/REVISION | |
| echo "$version @ $REF" > $apppath/VERSION | |
| tar -zcf $archive -C $RELEASE_PATH $APPLICATION | |
| echo "timestamp=$timestamp" >> $GITHUB_OUTPUT | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| echo "archive=$archive" >> $GITHUB_OUTPUT | |
| echo "Release package built at $archive" | |
| env: | |
| REVISION: ${{ github.sha }} | |
| REF: ${{ github.ref }} | |
| RELEASE_PATH: _build/prod/rel | |
| APPLICATION: coophub | |
| - name: Upload package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coophub-release | |
| path: ${{ steps.build_package.outputs.archive }} | |
| - name: Upload release asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ steps.build_package.outputs.archive }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Dispatch release | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ secrets.REPO_DISPATCH_TOKEN }} | |
| repository: ${{ secrets.REPO_DISPATCH_PATH }} | |
| event-type: coophub-release | |
| client-payload: '{"tag": "${{ env.RELEASE_TAG }}", "ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' |