From 53ca5eb2d318523c3b1232b1fdb814a8249d2ba8 Mon Sep 17 00:00:00 2001 From: Morlay Date: Wed, 30 Sep 2020 09:20:56 +0800 Subject: [PATCH] bump workflow actions to docker official provided --- .github/dependabot.yml | 6 ++++ .github/workflows/build.yml | 57 +++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..90963715 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70519ada..3325454b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,32 +14,39 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - - uses: crazy-max/ghaction-docker-buildx@v3 with: - buildx-version: v0.4.1 - - - name: update submodules - run: git submodule update --init + submodules: true - - name: login docker - run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-buildx-action@v1 + - uses: docker/login-action@v1 + with: + password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKER_USERNAME }} - - name: build edge image - if: github.ref == 'refs/heads/master' + - name: check and set image version + id: prepare run: | - docker buildx build \ - --push \ - --platform=linux/arm64,linux/amd64 \ - -f=docker/alpine/Dockerfile \ - -t=${{ github.repository }}:edge \ - . - - name: build version image - if: github.ref != 'refs/heads/master' - run: | - docker buildx build \ - --push \ - --platform=linux/arm64,linux/amd64 \ - -f=docker/alpine/Dockerfile \ - -t=${{ github.repository }}:$(echo ${{ github.ref }} | sed -E 's|refs/tags/||') \ - . \ No newline at end of file + case ${{ github.ref }} in + refs/heads/master) + echo ::set-output name=version::edge + echo ::set-output name=push::true + ;; + refs/tags/*) + echo ::set-output name=version::$(echo ${{ github.ref }} | sed -E 's|refs/tags/||') + echo ::set-output name=push::true + ;; + *) + echo ::set-output name=version::${{ github.sha }} + echo ::set-output name=push::false + ;; + esac; + + - name: build & push image + uses: docker/build-push-action@v2 + with: + context: . + file: docker/alpine/Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ steps.prepare.outputs.push }} + tags: ${{ github.repository }}:${{ steps.prepare.outputs.version }} \ No newline at end of file