Skip to content

Commit

Permalink
separate workflow for tagged release
Browse files Browse the repository at this point in the history
  • Loading branch information
dfederschmidt committed Apr 28, 2021
1 parent d80081c commit 78e9db4
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Main Branch CI
on:
push:
branches: master
tags:
- '*'
jobs:
test:
runs-on: ubuntu-latest
Expand Down
111 changes: 111 additions & 0 deletions .github/workflows/tagged_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Main Branch CI

on:
push:
tags:
- "v*"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry pytest
poetry install
- name: Test with pytest
env:
SECRET_KEY: TestKey
DATABASE_URL: sqlite:///db.sqlite3
DEBUG: true
run: |
poetry run pytest
docker:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/splunk/urlprompt
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to ghcr
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
-
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Create ZIP packages
run: |
cd compose && zip -r docker-compose-standalone.zip standalone/*
zip -r docker-compose-proxy.zip proxy/*
- name: Automatic Releases
uses: marvinpinto/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: "Development Build"
files: |
LICENSE.txt
compose/docker-compose-standalone.zip
compose/docker-compose-proxy.zip

0 comments on commit 78e9db4

Please sign in to comment.