-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automation for building,PR checking and Releasing by GitHub Actions (#8)
* Create autobuild.yml * solve docker repo for github packages * remove space * only master branch tags latest; ignore md changes. * add release action * ignore by paths-ignore * add build badge * add pr build check * add name for jobs
- Loading branch information
1 parent
f57233f
commit 03b2ba5
Showing
4 changed files
with
117 additions
and
1 deletion.
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,50 @@ | ||
name: Build Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
paths-ignore: | ||
- '*.md' | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build & Publish Docker | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set DOCKER_REPO_NAME env | ||
run: echo ::set-env name=DOCKER_REPO_NAME::$(basename ${GITHUB_REPOSITORY}) | ||
- name: Set IMAGE_TAG env | ||
run: echo ::set-env name=IMAGE_TAG::$(basename ${GITHUB_REF}) | ||
- name: Environment Printer | ||
uses: managedkaos/print-env@v1.0 | ||
- name: Append latest if master branches # env '${IMAGE_TAG},latest' | ||
if: endsWith(github.ref, 'master') | ||
run: echo ::set-env name=IMAGE_TAG::${IMAGE_TAG},latest | ||
- name: Environment Printer | ||
uses: managedkaos/print-env@v1.0 | ||
|
||
- name: Build & Publish to Github Package | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
with: | ||
name: ${{ github.repository }}/${{ env.DOCKER_REPO_NAME }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
registry: docker.pkg.github.com | ||
snapshot: false | ||
tags: "${{ env.IMAGE_TAG }}" | ||
|
||
- name: Build & Publish to DockerHub | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
with: | ||
name: ${{ github.repository }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
snapshot: false | ||
tags: "${{ env.IMAGE_TAG }}" | ||
|
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,20 @@ | ||
name: PR Build | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
|
||
build: | ||
name: PR Build & Check | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Environment Printer | ||
uses: managedkaos/print-env@v1.0 | ||
|
||
- run: docker build . |
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,45 @@ | ||
name: Release Action Docker | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
|
||
build: | ||
name: Release Action Docker | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set DOCKER_REPO_NAME env | ||
run: echo ::set-env name=DOCKER_REPO_NAME::$(basename ${GITHUB_REPOSITORY}) | ||
- name: Set IMAGE_TAG env | ||
run: echo ::set-env name=IMAGE_TAG::$(basename ${GITHUB_REF}) | ||
- name: Append latest for each release | ||
run: echo ::set-env name=IMAGE_TAG::${IMAGE_TAG},latest | ||
- name: Environment Printer | ||
uses: managedkaos/print-env@v1.0 | ||
|
||
- name: Build & Publish to Github Package | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
with: | ||
name: ${{ github.repository }}/${{ env.DOCKER_REPO_NAME }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
registry: docker.pkg.github.com | ||
snapshot: false | ||
tags: "${{ env.IMAGE_TAG }}" | ||
|
||
- name: Build & Publish to DockerHub | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
with: | ||
name: ${{ github.repository }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
snapshot: false | ||
tags: "${{ env.IMAGE_TAG }}" | ||
|
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