Skip to content

Commit

Permalink
use reusable workflow for test and release
Browse files Browse the repository at this point in the history
  • Loading branch information
TanklesXL committed May 6, 2024
1 parent 4203f8c commit e7b4559
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/release.yaml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,35 @@ name: Release
on:
push:
tags:
- "v*.*.*"

env:
GLEAM_VERSION: "1.1.0"
ERLANG_VERSION: 26
- v*.*.*

jobs:
gh-release:
test:
uses: TanklesXL/glint/.github/workflows/test.yml@main

release-gh:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1

hexpm-publish:
release-hex:
runs-on: ubuntu-latest
environment: publish
steps:
- uses: actions/checkout@v2
- uses: actions/cache/restore@v4
with:
path: ./build/packages
key: deps-${{ hashFiles('manifest.toml') }}
- uses: erlef/setup-beam@v1
with:
otp-version: ${{env.ERLANG_VERSION}}
gleam-version: ${{env.GLEAM_VERSION}}
otp-version: 26
rebar3-version: 3
gleam-version: "1.1.0"
- name: publish to hex
env:
HEXPM_USER: ${{ secrets.HEXPM_USER }}
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/main.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Run Tests
name: Test

env:
GLEAM_VERSION: "1.1.0"
ERLANG_VERSION: "26"
REBAR3_VERSION: 3

on:
push:
branches:
- main
pull_request:
workflow_call:

jobs:
format:
Expand All @@ -16,8 +19,8 @@ jobs:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: 26
rebar3-version: 3
otp-version: ${{ env.ERLANG_VERSION }}
rebar3-version: ${{ env.REBAR3_VERSION }}
gleam-version: ${{ env.GLEAM_VERSION }}
- run: gleam format --check src test

Expand All @@ -34,8 +37,8 @@ jobs:
- if: ${{ steps.restore.outputs.cache-hit != 'true' }}
uses: erlef/setup-beam@v1
with:
otp-version: 26
rebar3-version: 3
otp-version: ${{ env.ERLANG_VERSION }}
rebar3-version: ${{ env.REBAR3_VERSION }}
gleam-version: ${{ env.GLEAM_VERSION }}
- if: ${{ steps.restore.outputs.cache-hit != 'true' }}
run: gleam deps download
Expand All @@ -61,7 +64,7 @@ jobs:
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.erlang}}
rebar3-version: 3
rebar3-version: ${{ env.REBAR3_VERSION }}
gleam-version: ${{env.GLEAM_VERSION}}
- run: gleam test --target erlang

Expand All @@ -80,7 +83,7 @@ jobs:
key: deps-${{ hashFiles('manifest.toml') }}
- uses: erlef/setup-beam@v1
with:
otp-version: 26
otp-version: ${{ env.ERLANG_VERSION }}
gleam-version: ${{env.GLEAM_VERSION}}
- uses: actions/setup-node@v4
with:
Expand Down

0 comments on commit e7b4559

Please sign in to comment.