From 52640f08d2c9026cb55f05e869cd5ca0839de053 Mon Sep 17 00:00:00 2001 From: Mark Schmitt <31215086+MarkSchmitt@users.noreply.github.com> Date: Fri, 8 Jan 2021 20:37:25 +0100 Subject: [PATCH] github action improved tagging --- .github/workflows/docker.yml | 24 +++++++++++++----------- .github/workflows/documentation.yml | 1 + .github/workflows/frontend.yml | 2 +- .github/workflows/test.yml | 4 ++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 338ae85a9..715474a85 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,32 +1,34 @@ -name: Docker +name: docker on: push: - branches: travis-multiarch-builds + branches: + - master + - dev + tags: + - 'ng-*' jobs: - # Build and push image to docker hub. + # build and push image to docker hub. buildx: runs-on: ubuntu-latest - needs: [tests, documentation, frontend] - if: github.ref == 'refs/heads/github-action-test' steps: - uses: actions/checkout@v2 - - name: Prepare id: prepare + env: + DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }} run: | - DOCKER_IMAGE=moztr/paperless-ng DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64/v8 VERSION=edge if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/v} + VERSION=${GITHUB_REF#refs/tags/} fi - if [ "${{ github.event_name }}" = "schedule" ]; then - VERSION=nightly + if [[ $GITHUB_REF == refs/heads/* ]]; then + VERSION=${GITHUB_REF#refs/heads/} fi TAGS="--tag ${DOCKER_IMAGE}:${VERSION}" - if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + if [[ $VERSION == "master" ]]; then TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest" fi echo ::set-output name=docker_image::${DOCKER_IMAGE} diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 2e2e84e84..12bd3577d 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -24,6 +24,7 @@ jobs: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip3.6.8} - name: dependencies + # instead of directly installing the dependency in the workflow file, can this be done using the pipfile instead? run: | pip install 'sphinx~=3.3' sphinx_rtd_theme - name: make diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index ad44fb717..66a9a9b0c 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -1,6 +1,6 @@ name: frontend -# always run frontend workflow +# always run frontend workflow to see if it builds and tests run fine on: push jobs: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 930f368e7..1a235f763 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,8 +8,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04] - python: + os: ubuntu-20.04] + python: # pyenv-action requires the exact version - 3.6.8 - 3.7.9 - 3.8.6