This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #39 from demokratie-live/feature/docker_hub
move docker image to docker hub
- Loading branch information
Showing
1 changed file
with
42 additions
and
32 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,40 +1,50 @@ | ||
name: Docker Image | ||
name: bundestag.io-admin/ Build and Push Docker Image | ||
|
||
on: | ||
- push | ||
push: | ||
branches: | ||
- "master" | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
build: | ||
name: Build Docker | ||
push: | ||
runs-on: ubuntu-latest | ||
environment: docker | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo dev)" | ||
id: extract_branch | ||
|
||
# - name: Extract branch name | ||
# shell: bash | ||
# run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
# id: extract_branch | ||
|
||
- name: Read package.json | ||
uses: tyankatsu0105/read-package-version-actions@v1 | ||
id: package-version | ||
|
||
- name: Extract repository name | ||
shell: bash | ||
run: echo "##[set-output name=REPOSITORY_NAME;]$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" | ||
id: extract_repository | ||
|
||
- uses: docker/build-push-action@v1 | ||
images: democracy/bundestag.io-admin | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
registry: docker.pkg.github.com | ||
repository: ${{ github.repository }}/${{ steps.extract_repository.outputs.REPOSITORY_NAME }} | ||
tags: ${{ steps.package-version.outputs.version }}-${{ steps.extract_branch.outputs.branch }} | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |