From 3f75d012260a99966bc0f3e7e36c855ef3e02202 Mon Sep 17 00:00:00 2001 From: Xiaonan Shen Date: Wed, 15 Apr 2020 22:14:18 -0700 Subject: [PATCH] Use Docker Hub build --- .github/workflows/main.yaml | 18 ++++++------------ check-update.sh | 4 ++-- push-tag.sh | 11 +++++++++++ 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 push-tag.sh diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 20355ef..6f0c388 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -3,9 +3,9 @@ name: build on: push: tags: - - '*' + - 'v*' repository_dispatch: - types: update + types: build env: DOCKER_TAG: shenxn/protonmail-bridge @@ -44,13 +44,7 @@ jobs: asset_path: ./deb/${{ env.DEB_FILE }} asset_name: ${{ env.DEB_FILE }} asset_content_type: application/vnd.debian.binary-package - - name: Docker Login - uses: azure/docker-login@v1 - with: - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Docker Build - run: | - docker build . -t ${DOCKER_TAG}:latest -t ${DOCKER_TAG}:${RELEASE} - docker push ${DOCKER_TAG}:latest - docker push ${DOCKER_TAG}:${RELEASE} + - name: Push Tag to Trigger Docker Hub Build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: bash push-tag.sh diff --git a/check-update.sh b/check-update.sh index 092e2c5..3270a0c 100644 --- a/check-update.sh +++ b/check-update.sh @@ -19,7 +19,7 @@ if [[ RELEASE != CURR_RELEASE ]]; then git config --local user.name "Github Action" git add releaserc git commit -m "Release ${CURR_RELEASE}" --author="Xiaonan Shen " - git tag -a ${CURR_RELEASE} -m "Release ${CURR_RELEASE}" + git tag -a "v${CURR_RELEASE}" -m "Release ${CURR_RELEASE}" # push REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" @@ -30,6 +30,6 @@ if [[ RELEASE != CURR_RELEASE ]]; then curl -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${PERSONAL_TOKEN}" \ --request POST \ - --data '{"event_type": "update"}' \ + --data '{"event_type": "build"}' \ https://api.github.com/repos/${GITHUB_REPOSITORY}/dispatches fi diff --git a/push-tag.sh b/push-tag.sh new file mode 100644 index 0000000..698d6d9 --- /dev/null +++ b/push-tag.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -ex + +source ./releaserc + +git config --local user.email "actions@github.com" +git config --local user.name "Github Action" +git tag -a "r${RELEASE}" -m "Release ${RELEASE}" +REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" +git push "${REMOTE_REPO}" "r${RELEASE}"