-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from avencera/add-github-container
Push to github docker registry
- Loading branch information
Showing
2 changed files
with
48 additions
and
15 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 |
---|---|---|
@@ -1,25 +1,56 @@ | ||
name: Release CI | ||
name: Release Dockerized CI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
- "v*" | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
name: Build Docker image for tagged release | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Get the tagged version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
- name: Build the Docker image for the tagged release | ||
run: docker build . --tag ${{ secrets.DOCKERHUB_USERNAME }}/rustywind:${{ steps.get_version.outputs.VERSION }} | ||
- name: Build the Docker image for the latest tag | ||
run: docker build . --tag ${{ secrets.DOCKERHUB_USERNAME }}/rustywind:latest | ||
- name: Push to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
run: docker login -u="${{ secrets.DOCKERHUB_USERNAME }}" -p="${{ secrets.DOCKERHUB_TOKEN }}" && docker push ${{ secrets.DOCKERHUB_USERNAME }}/rustywind:latest && docker push ${{ secrets.DOCKERHUB_USERNAME }}/rustywind:${{ steps.get_version.outputs.VERSION }} | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
avencera/rustywind | ||
ghcr.io/avencera/rustywind | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}}.{{minor}}.{{patch}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
- name: Login to DockerHub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Login to GHCR | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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