diff --git a/.github/workflows/semantic_release.yml b/.github/workflows/semantic_release.yml index 2a0ce2f..496087a 100644 --- a/.github/workflows/semantic_release.yml +++ b/.github/workflows/semantic_release.yml @@ -3,23 +3,50 @@ on: push: branches: - main + - rc - beta + - alpha - "*.x" + jobs: + get-next-version: + uses: lenra-io/github-actions/.github/workflows/get-version.yml@main + release: - name: Release + needs: [get-next-version] + if: ${{ needs.get-next-version.outputs.will-release == 'true' }} + uses: lenra-io/github-actions/.github/workflows/release.yml@main + publish: + name: publish + needs: [get-next-version] + if: ${{ needs.get-next-version.outputs.will-release == 'true' }} runs-on: ubuntu-latest - timeout-minutes: 10 + env: + VERSION: ${{ needs.get-next-version.outputs.version }} steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v2 + - name: Checkout Code + uses: actions/checkout@v3 + - name: Set version + shell: bash + run: 'sed -i -r "s/version: \"[0-9]+(\.[0-9]+){2}\"/version: \"${{ env.VERSION }}\"/g" mix.exs' + - name: Set up Elixir + uses: erlef/setup-elixir@b980a5ac9b7316a23ebc16de2bb69b7c3ad731b5 with: - node-version: "14" - - name: Setup node deps - run: npm i conventional-changelog-conventionalcommits@4 -D - - name: Release + elixir-version: "1.12" # Define the elixir version [required] + otp-version: "24" # Define the OTP version [required] + - name: Restore dependencies cache + uses: actions/cache@v2 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + - name: Get dependencies + shell: bash + run: mix deps.get + - name: Publish package to hex.pm + shell: bash + run: mix hex.publish --yes env: - GITHUB_TOKEN: ${{ secrets.WORKFLOW_GITHUB_TOKEN }} - run: npx semantic-release@18 + HEX_API_KEY: ${{ secrets.HEX_API_KEY }}