Skip to content

Commit

Permalink
CI/CD reworking
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-uk committed Oct 13, 2020
1 parent cc63760 commit 0694ebd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/docker-ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
name: Build Dockerhub Image

on:
push:
on:
push:
branches: [master]
pull_request:
branches: [master]

env:
dockerUser: bencuk
imageName: kubeview
imageTag: latest

jobs:
buildJob:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v1

- name: Check server code with gofmt
run: bash .github/workflows/gofmt-action.sh cmd/server

- name: Check server code with gofmt
run: bash .github/workflows/gofmt-action.sh cmd/server
- name: Build the Docker image
run: docker build . --file ./build/Dockerfile --build-arg buildInfo="GitHub CI build $GITHUB_RUN_ID, of $GITHUB_REF on $(date -I)" --tag ghcr.io/$GITHUB_ACTOR/$imageName:$imageTag

- name: Build the Docker image
run: docker build . --file ./build/Dockerfile --build-arg buildInfo="GitHub CI build $GITHUB_RUN_ID, of $GITHUB_REF on $(date -I)" --tag $dockerUser/$imageName:$imageTag

- name: Login to Dockerhub
if: github.repository == 'benc-uk/kubeview' && github.event_name == 'push'
run: docker login -u $dockerUser -p ${{ secrets.dockerPassword }}

- name: Push to Dockerhub
if: github.repository == 'benc-uk/kubeview' && github.event_name == 'push'
run: docker push $dockerUser/$imageName:$imageTag
- name: Push to Github registry
run: |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/$GITHUB_ACTOR/$imageName:$imageTag
34 changes: 17 additions & 17 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ jobs:
steps:
- uses: actions/checkout@v1

# - name: Build the Docker image
# run: docker build . --file ./build/Dockerfile --build-arg version="${{ github.event.release.tag_name }}" --build-arg buildInfo="GitHub release build dated:$(date -I)" --tag $dockerUser/$imageName:${{ github.event.release.tag_name }}
- name: Build the Docker image
run: docker build . --file ./build/Dockerfile --build-arg version="${{ github.event.release.tag_name }}" --build-arg buildInfo="GitHub release build dated:$(date -I)" --tag ghcr.io/$GITHUB_ACTOR/$imageName:${{ github.event.release.tag_name }}

# - name: Login to Dockerhub
# run: docker login -u $dockerUser -p ${{ secrets.dockerPassword }}

# - name: Push to Dockerhub
# run: docker push $dockerUser/$imageName:${{ github.event.release.tag_name }}
- name: Push to Github registry
run: |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/$GITHUB_ACTOR/$imageName:${{ github.event.release.tag_name }}
- name: Package Helm chart
run: helm package kubeview --version 0.0.0
working-directory: ./deployments/helm
# - name: Upload extension package to release
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: ./deployments/helm/kubeview-${{ github.event.release.tag_name }}.tgz
# asset_name: kubeview-${{ github.event.release.tag_name }}.tgz
# asset_content_type: application/octet-stream

- name: Upload Helm chart to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deployments/helm/kubeview-0.0.0.tgz
asset_name: kubeview-${{ github.event.release.tag_name }}.tgz
asset_content_type: application/octet-stream

0 comments on commit 0694ebd

Please sign in to comment.