From 12a674d6fb356883f4c5a9bddcdd34a4ec6a9740 Mon Sep 17 00:00:00 2001 From: Stephan Fudeus Date: Sat, 18 May 2024 21:55:47 +0200 Subject: [PATCH] Rework workflows --- .../docker-build-publish-branch.yaml | 37 ------------------ .../workflows/docker-build-publish-pr.yaml | 14 +++++++ .github/workflows/docker-build-publish.yaml | 38 +++---------------- .github/workflows/docker-build.yaml | 21 ---------- .github/workflows/python-build.yaml | 23 +---------- 5 files changed, 22 insertions(+), 111 deletions(-) delete mode 100644 .github/workflows/docker-build-publish-branch.yaml create mode 100644 .github/workflows/docker-build-publish-pr.yaml delete mode 100644 .github/workflows/docker-build.yaml diff --git a/.github/workflows/docker-build-publish-branch.yaml b/.github/workflows/docker-build-publish-branch.yaml deleted file mode 100644 index 6bb01f1..0000000 --- a/.github/workflows/docker-build-publish-branch.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: Docker Build/Publish Preview Image from branch -on: - push: - branches-ignore: - - master - - main - workflow_dispatch: {} - -jobs: - build: - runs-on: ubuntu-latest - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Define revision - id: revision - run: | - echo "target-revision=preview-${GITHUB_REF##*/}" >> $GITHUB_OUTPUT - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Docker login - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Docker build/push - uses: docker/build-push-action@v5 - with: - platforms: linux/amd64,linux/arm/v7,linux/arm64 - tags: | - "${{ github.repository }}:${{ steps.revision.outputs.target-revision }}" - push: true diff --git a/.github/workflows/docker-build-publish-pr.yaml b/.github/workflows/docker-build-publish-pr.yaml new file mode 100644 index 0000000..9ccf64f --- /dev/null +++ b/.github/workflows/docker-build-publish-pr.yaml @@ -0,0 +1,14 @@ +name: Docker Build/Publish Preview Image from PR +on: + pull_request: + branches: + - master + - main + workflow_dispatch: {} + +jobs: + build: + uses: sfudeus/workflows/.github/workflows/docker-build-publish-pr.yaml + secrets: inherit + with: + tag: preview-${{ github.event.number }} diff --git a/.github/workflows/docker-build-publish.yaml b/.github/workflows/docker-build-publish.yaml index fea48a6..59e20bb 100644 --- a/.github/workflows/docker-build-publish.yaml +++ b/.github/workflows/docker-build-publish.yaml @@ -1,40 +1,14 @@ -name: Docker Build/Publish Release +name: Docker Build/Publish Image on: push: - tags: - - "*" + branches: + - master + - main schedule: - cron: '15 6 * * 0' workflow_dispatch: {} jobs: build: - runs-on: ubuntu-latest - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Define revision - id: revision - run: | - REVISION=$(date +%F) - echo "target-revision=$REVISION" >> $GITHUB_OUTPUT - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Docker login - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Docker build/push - uses: docker/build-push-action@v5 - with: - platforms: linux/amd64,linux/arm/v7,linux/arm64 - tags: | - "${{ github.repository }}:${{ steps.revision.outputs.target-revision }}" - "${{ github.repository }}:latest" - push: true + uses: sfudeus/workflows/.github/workflows/docker-build-publish-branch.yaml + secrets: inherit diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml deleted file mode 100644 index de660ac..0000000 --- a/.github/workflows/docker-build.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Docker Build Image -on: - push: - branches: - - master - - main -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Docker build - uses: docker/build-push-action@v5 - with: - platforms: linux/amd64,linux/arm/v7,linux/arm64 - push: false diff --git a/.github/workflows/python-build.yaml b/.github/workflows/python-build.yaml index e56467d..17b9555 100644 --- a/.github/workflows/python-build.yaml +++ b/.github/workflows/python-build.yaml @@ -12,24 +12,5 @@ on: jobs: build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint wth pylint - run: pylint --rcfile pylintrc --exit-zero *.py - - name: Test with pytest - run: pytest + uses: sfudeus/workflows/.github/workflows/python-build.yaml + secrets: inherit