livebook/.github/workflows/deploy.yaml
Jonatan Kłosko 47d29cb389
Require Elixir 1.13 (#737)
* Bump required Elixir version to 1.13 and fix TODOs

* Fix tests

* Remove the deprecated URI.parse/1

* Bump Docker base image

* Bump Elixir on CI
2021-12-03 21:47:20 +01:00

90 lines
2.7 KiB
YAML

name: Deploy
on:
push:
branches:
- main
tags:
- 'v*.*.*'
jobs:
assets:
outputs:
sha: ${{ steps.push_assets.outputs.commit_hash }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Erlang & Elixir
uses: erlef/setup-beam@v1
with:
otp-version: '24.0'
elixir-version: '1.13.0'
- name: Cache Mix
uses: actions/cache@v2
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
# Note: we need to get Phoenix and LV because package.json points to them directly
- name: Install mix dependencies
run: mix deps.get
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Cache npm dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Clean generated assets
run: rm -rf static/{js,css}
- name: Install npm dependencies
run: npm ci --prefix assets
- name: Build assets
run: npm run deploy --prefix assets
- name: Push updated assets
id: push_assets
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update assets
file_pattern: static
docker:
# The assets job may push new commit, so we wait for it
needs: [assets]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# The output is set only if there was a commit, otherwise
# we pass an empty ref and and the default is used
ref: ${{ needs.assets.outputs.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: livebook/livebook
tags: |
type=semver,pattern={{version}}
type=edge,branch=main
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max