-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c76af6a
commit 0f14a46
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build | ||
on: | ||
push: {} | ||
workflow_dispatch: {} | ||
schedule: | ||
- cron: '30 3 * * *' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set Docker image tag version | ||
id: image-name | ||
run: | | ||
case "$GITHUB_REF" in | ||
refs/heads/master) | ||
TAG=latest;; | ||
*) | ||
echo "Branch not recognized" >&2 | ||
exit;; | ||
esac | ||
: ${TAG:=latest} | ||
echo "::set-output name=tag::$TAG" | ||
echo "::set-output name=name::yangzhaofengsteven/hidden-sftp:$TAG" | ||
- name: Build Docker image | ||
run: | | ||
IMAGE="${{ steps.image-name.outputs.name }}" | ||
docker pull "$IMAGE" | ||
docker build --cache-from "$IMAGE" -t build-image . | ||
- name: Push to Docker Hub | ||
if: "github.repository == 'yangzhaofeng/docker-hidden-sftp'" | ||
run: | | ||
IMAGE="${{ steps.image-name.outputs.name }}" | ||
docker tag build-image "$IMAGE" | ||
docker login -u "${{ secrets.DOCKER_USER }}" -p "${{ secrets.DOCKER_PASS }}" | ||
docker push "$IMAGE" | ||