mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-03-22 09:41:59 +00:00
To improve supply-chain security, reference all GitHub actions using the hash of the released tag. GitHub recommends to do this for third-party actions (https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions). In order to make our CI more deterministic, I opted to do it for all our actions. This means any change to our workflow configuration requires a source code change and thus passing CI on our end. Dependabot will automatically issue PRs for these actions and update the comment with the new version next to them. Resolves: #2497.
58 lines
2.0 KiB
YAML
58 lines
2.0 KiB
YAML
name: "Setup Elixir"
|
|
description: "Sets up the correct Elixir version and installs deps"
|
|
inputs:
|
|
mix_env:
|
|
description: "Limit deps to mix env"
|
|
type: string
|
|
required: true
|
|
outputs:
|
|
otp-version:
|
|
description: "The OTP version"
|
|
value: ${{ steps.versions.outputs.erlang }}
|
|
elixir-version:
|
|
description: "The Elixir version"
|
|
value: ${{ steps.versions.outputs.elixir }}
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Tool Versions
|
|
id: versions
|
|
uses: marocchino/tool-versions-action@18a164fa2b0db1cc1edf7305fcb17ace36d1c306 # v1.2.0
|
|
- uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # v1.18.2
|
|
id: setup-beam
|
|
with:
|
|
otp-version: ${{ steps.versions.outputs.erlang }}
|
|
elixir-version: ${{ steps.versions.outputs.elixir }}
|
|
- name: Setup Hex and Rebar
|
|
shell: bash
|
|
working-directory: ./elixir
|
|
run: |
|
|
mix local.hex --force
|
|
mix local.rebar --force
|
|
- uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
|
|
name: Restore Elixir Deps Cache
|
|
id: cache
|
|
with:
|
|
path: |
|
|
elixir/deps
|
|
elixir/_build/${{ inputs.mix_env }}
|
|
key: elixir-deps-${{ runner.os }}-${{ runner.arch }}-${{ inputs.mix_env }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('elixir/mix.lock') }}
|
|
- name: Install Dependencies
|
|
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
|
|
shell: bash
|
|
working-directory: ./elixir
|
|
run: mix deps.get --only ${{ inputs.mix_env }}
|
|
- name: Compile Dependencies
|
|
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
|
|
shell: bash
|
|
working-directory: ./elixir
|
|
run: mix deps.compile --skip-umbrella-children
|
|
- uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
|
|
name: Save Elixir Deps Cache
|
|
if: ${{ github.ref_name == 'main' }}
|
|
with:
|
|
path: |
|
|
elixir/deps
|
|
elixir/_build/${{ inputs.mix_env }}
|
|
key: ${{ steps.cache.outputs.cache-primary-key }}
|