Skip to content

Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #27

Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows

Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #27

on: push
name: Privately published Elixir Library (with git ops)
env:
ELIXIR_VERSION: "1.9"
OTP_VERSION: "22.2"
jobs:
deps:
runs-on: ubuntu-latest
env:
NARRATIVE_HEX_ORG_API_KEY: ${{ secrets.NARRATIVE_HEX_ORG_API_KEY }}
MIX_ENV: test
steps:
- name: Checking out project
uses: actions/checkout@v2
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Signing into narrativeapp organisation on hex
run: mix hex.organization auth narrativeapp --key $NARRATIVE_HEX_ORG_API_KEY
- name: Downloading dependency cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-deps
- run: mix deps.get
- name: Uploading dependencies for other jobs
uses: actions/upload-artifact@v2
with:
name: deps
path: deps/
build:
runs-on: ubuntu-latest
needs: ["deps"]
env:
MIX_ENV: test
steps:
- name: Checking out project
uses: actions/checkout@v2
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Downloading dependencies
uses: actions/[email protected]
with:
name: deps
path: deps/
- name: Downloading build artifact cache
uses: actions/cache@v2
with:
path: _build
key: ${{ runner.os }}-build
- name: Run `mix compile`
run: mix deps.compile && mix compile
- name: Uploading build artifacts for other jobs
uses: actions/upload-artifact@v2
with:
name: build
path: _build/
credo:
runs-on: ubuntu-latest
needs: ["deps", "build"]
env:
MIX_ENV: test
steps:
- name: Checking out project
uses: actions/checkout@v2
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Downloading dependencies
uses: actions/[email protected]
with:
name: deps
path: deps/
- name: Downloading build artifacts
uses: actions/[email protected]
with:
name: build
path: _build/
- run: mix credo --strict
formatter:
runs-on: ubuntu-latest
steps:
- name: Checking out project
uses: actions/checkout@v2
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix format --check-formatted
audit:
runs-on: ubuntu-latest
needs: ["deps"]
env:
NARRATIVE_HEX_ORG_API_KEY: ${{ secrets.NARRATIVE_HEX_ORG_API_KEY }}
MIX_ENV: test
steps:
- name: Checking out project
uses: actions/checkout@v2
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix hex.organization auth narrativeapp --key $NARRATIVE_HEX_ORG_API_KEY
- name: Downloading dependencies
uses: actions/[email protected]
with:
name: deps
path: deps/
- run: mix hex.audit
test:
runs-on: ubuntu-latest
needs: ["deps", "build"]
env:
MIX_ENV: test
steps:
- name: Checking out project
uses: actions/checkout@v2
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Downloading dependencies
uses: actions/[email protected]
with:
name: deps
path: deps/
- name: Downloading build artifacts
uses: actions/[email protected]
with:
name: build
path: _build/
- run: mix test
is_releasable:
runs-on: ubuntu-latest
needs: ["deps", "test", "audit", "formatter", "credo"]
if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/master'}}
env:
HEX_API_KEY: ${{ secrets.NARRATIVE_HEX_ORG_API_KEY }}
steps:
- name: Checking out project
uses: actions/checkout@v2
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Downloading dependencies
uses: actions/[email protected]
with:
name: deps
path: deps/
- name: Downloading build artifacts
uses: actions/[email protected]
with:
name: build
path: _build/
- name: Getting app information
id: app-info
run: MIX_ENV=test mix git_ops.project_info --format github-actions
- name: Run mix hex.build
run: mix hex.build -o ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}.tar
- name: Uploading hex package as job artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}.tar
path: ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}.tar
- name: Run mix docs
run: MIX_ENV=test mix docs && tar zcvf docs.tar.gz doc/
- name: Uploading documentation as job artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.app-info.outputs.app_name }}-docs-${{ steps.app-info.outputs.app_version }}.tar.gz
path: docs.tar.gz
git_ops:
runs-on: ubuntu-latest
needs: ["deps", "test", "audit", "formatter", "credo"]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
env:
HEX_API_KEY: ${{ secrets.NARRATIVE_HEX_ORG_API_KEY }}
steps:
- name: Checking out project
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "Setting up Elixir"
uses: actions/setup-elixir@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Downloading dependencies
uses: actions/[email protected]
with:
name: deps
path: deps/
- name: Downloading build artifacts
uses: actions/[email protected]
with:
name: build
path: _build/
- name: Configure git author
run: git config user.email '41898282+github-actions[bot]@users.noreply.github.com' ; git config user.name 'github-actions'
- name: Retrieving the current app version
id: original-app-info
run: MIX_ENV=test mix git_ops.project_info --format github-actions
- name: Run mix git_ops.release
run: MIX_ENV=test mix git_ops.release --yes || true
- name: Checking for new app version
id: app-info
run: MIX_ENV=test mix git_ops.project_info --format github-actions
- name: Building hex package
if: ${{ steps.original-app-info.outputs.app_version != steps.app-info.outputs.app_version }}
run: mix hex.build -o ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}.tar
- name: Building hex docs
if: ${{ steps.original-app-info.outputs.app_version != steps.app-info.outputs.app_version }}
run: MIX_ENV=test mix docs && tar zcvf ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}-docs.tar.gz doc/
- name: Pushing new tag
if: ${{ steps.original-app-info.outputs.app_version != steps.app-info.outputs.app_version }}
run: git push "https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}" HEAD:${{ github.ref }} refs/tags/v${{ steps.app-info.outputs.app_version }}
- name: Creating new Github release
if: ${{ steps.original-app-info.outputs.app_version != steps.app-info.outputs.app_version }}
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: v${{ steps.app-info.outputs.app_version }}
release_name: Release ${{ steps.app-info.outputs.app_name }} ${{ steps.app-info.outputs.app_version }}
body: Autogenerated by git_ops release.
- name: Uploading hex package as release artifact
if: ${{ steps.original-app-info.outputs.app_version != steps.app-info.outputs.app_version }}
id: upload-package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}.tar
asset_name: ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}.tar
asset_content_type: application/x-tar
- name: Uploading documentation as release artifact
if: ${{ steps.original-app-info.outputs.app_version != steps.app-info.outputs.app_version }}
id: upload-docs
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}-docs.tar.gz
asset_name: ${{ steps.app-info.outputs.app_name }}-${{ steps.app-info.outputs.app_version }}-docs.tar.gz
asset_content_type: application/gzip
- name: Publishing hex package
if: ${{ steps.original-app-info.outputs.app_version != steps.app-info.outputs.app_version }}
run: mix hex.publish --organization narrativeapp --yes