Skip to content

Commit

Permalink
Merge branch 'release/v2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
julien1619 committed Jan 20, 2021
2 parents 086ac4d + 1f8846e commit 7b02a31
Show file tree
Hide file tree
Showing 18 changed files with 524 additions and 735 deletions.
75 changes: 68 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Build

on: [push]

Expand All @@ -9,14 +9,45 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Caching

- name: Prepare tags
id: prep
run: |
DOCKER_IMAGE=creatiwity/siren
VERSION=noop
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
elif [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=edge
fi
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
elif [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Caching MUSL
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-musl-${{ hashFiles('**/Cargo.lock') }}

- name: Build for MUSL
run: |
mkdir -p ~/.cargo/{git,registry}
Expand All @@ -27,16 +58,46 @@ jobs:
-v $GITHUB_WORKSPACE:/volume \
--rm -t clux/muslrust:stable \
sh -c "/volume/build-musl.sh && chown -R $(id -u):$(id -g) ./target /root/.cargo/registry /root/.cargo/git"
- name: Archive production artifact
uses: actions/upload-artifact@v2
with:
name: sirene
path: dist/sirene
- name: Push to Docker Hub
uses: docker/build-push-action@v1

- name: Caching Docker layers
if: github.event_name != 'pull_request'
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up QEMU
if: github.event_name != 'pull_request'
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
if: github.event_name != 'pull_request'
uses: docker/setup-buildx-action@v1
with:
driver-opts: image=moby/buildkit:master

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
path: "./dist"
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: creatiwity/siren
tag_with_ref: true

- name: Docker build and push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v2
with:
context: ./dist
file: ./dist/Dockerfile
push: true
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Loading

0 comments on commit 7b02a31

Please sign in to comment.