Browse Source

bump workflow actions to docker official provided

pull/2759/head
Morlay 4 years ago
parent
commit
53ca5eb2d3
2 changed files with 38 additions and 25 deletions
  1. 6
      .github/dependabot.yml
  2. 57
      .github/workflows/build.yml

6
.github/dependabot.yml

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

57
.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/||') \
.
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 }}
Loading…
Cancel
Save