From 8ecd53c215d4be0fc928860c4450e99321162025 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Fri, 22 Mar 2024 01:25:37 +0100 Subject: [PATCH] v0.0.1 --- .github/workflows/devel.yml | 117 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 52 +++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 .github/workflows/devel.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/devel.yml b/.github/workflows/devel.yml new file mode 100644 index 0000000..c654ec9 --- /dev/null +++ b/.github/workflows/devel.yml @@ -0,0 +1,117 @@ +name: devel +on: + pull_request: + push: + branches: + - master + - staging + - trying + +env: + DOCKER_IMAGE: localhost:5000/github.com/joseluisq/docker-lets-encrypt + +jobs: + docker-alpine: + name: Docker test + strategy: + matrix: + arch: + - linux/amd64 + - linux/386 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 + runs-on: ubuntu-20.04 + services: + registry: + image: registry:2 + ports: + - 5000:5000 + steps: + - + name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 1 + - + name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: docker-lets-encrypt-${{ matrix.arch }}-buildx-${{ github.sha }} + restore-keys: | + docker-lets-encrypt-${{ matrix.arch }}-buildx- + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Docker meta alpine + id: meta_alpine + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_IMAGE }} + flavor: | + latest=true + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + driver-opts: network=host + - + name: Build and export to Docker client + uses: docker/build-push-action@v3 + with: + context: . + platforms: ${{ matrix.arch }} + file: Dockerfile + load: true + tags: ${{ steps.meta_alpine.outputs.tags }} + labels: ${{ steps.meta_alpine.outputs.labels }} + - + name: Build and push to local registry + uses: docker/build-push-action@v3 + with: + context: . + platforms: ${{ matrix.arch }} + file: Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta_alpine.outputs.tags }} + labels: ${{ steps.meta_alpine.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + - + name: Test + uses: addnab/docker-run-action@v1 + with: + image: ${{ env.DOCKER_IMAGE }} + options: -v ${{ github.workspace }}:/cgit + run: | + uname -a + cat /etc/os-release + lego -v + lego -h + - + name: Inspect image + run: | + docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_alpine.outputs.version }} + - + name: Check manifest + if: github.event_name != 'pull_request' + run: | + docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_alpine.outputs.version }} + - + # 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..21d7165 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: release +on: + push: + tags: + - 'v0.[0-9]+.[0-9]+' + - 'v0.[0-9]+.[0-9]+-beta.[0-9]+' + +jobs: + docker: + runs-on: ubuntu-20.04 + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: joseluisq/docker-lets-encrypt + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + - + 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: Prepare Docker envs + shell: bash + run: | + echo "VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV + - + name: Build and push + uses: docker/build-push-action@v2 + with: + push: true + context: . + platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 + file: Dockerfile + tags: ${{ steps.meta.outputs.tags }} + build-args: | + VERSION=${{ env.VERSION }}