From befc35036eb3f20dd4d6b8c50c3a5049b7bf4fb3 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Mon, 24 May 2021 14:26:32 +1000 Subject: [PATCH] ci: Update membrane release workflow. --- .github/workflows/publish.yaml | 80 +++++++++------------------------- .github/workflows/release.yaml | 66 ++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dfd6506bc..7381c2eb5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,66 +1,26 @@ -name: Publish Docker images +name: Create Release on: - release: - types: [published] + pull_request: + types: [closed] + branches: + - 'main' jobs: - push_to_registry: - name: Push Docker image to Docker Hub + version_bump: + name: Bump Version and Create Release runs-on: ubuntu-latest steps: - - name: Check out the repo - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v5.5 with: - token: ${{secrets.GOLANG_TOKEN}} - submodules: recursive - - name: Get Tag - id: tag - run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3) - # Setup docker build image - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - # Login to dockerhub - - name: Login to DockerHub - uses: docker/login-action@v1 + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Create a GitHub release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - # Push development image - - name: Push Local Static image to Docker Hub - uses: docker/build-push-action@v2 - with: - context: . - file: ./plugins/dev/dev.dockerfile - push: true - tags: | - nitricimages/membrane-local:latest - nitricimages/membrane-local:${{ steps.tag.outputs.TAG }} - # Push AWS image - - name: Push AWS Static image to Docker Hub - uses: docker/build-push-action@v2 - with: - context: . - file: ./plugins/aws/aws.dockerfile - push: true - tags: | - nitricimages/membrane-aws:latest - nitricimages/membrane-aws:${{ steps.tag.outputs.TAG }} - # Push GCP image - - name: Push GCP Static image to Docker Hub - uses: docker/build-push-action@v2 - with: - context: . - file: ./plugins/gcp/gcp.dockerfile - push: true - tags: | - nitricimages/membrane-gcp:latest - nitricimages/membrane-gcp:${{ steps.tag.outputs.TAG }} - # Push Azure image - - name: Push Azure Static image to Docker Hub - uses: docker/build-push-action@v2 - with: - context: . - file: ./plugins/azure/azure.dockerfile - push: true - tags: | - nitricimages/membrane-azure:latest - nitricimages/membrane-azure:${{ steps.tag.outputs.TAG }} + tag_name: ${{ steps.tag_version.outputs.new_tag }} + release_name: Release ${{ steps.tag_version.outputs.new_tag }} + body: ${{ steps.tag_version.outputs.changelog }} + \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..b4a08f2ef --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,66 @@ +name: Release Docker images +on: + release: + types: [published] +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + with: + token: ${{secrets.GOLANG_TOKEN}} + submodules: recursive + - name: Get Tag + id: tag + run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3) + # Setup docker build image + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + # Login to dockerhub + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + # Push development image + - name: Push Local Static image to Docker Hub + uses: docker/build-push-action@v2 + with: + context: . + file: ./providers/dev/dev.dockerfile + push: true + tags: | + nitricimages/membrane-local:latest + nitricimages/membrane-local:${{ steps.tag.outputs.TAG }} + # Push AWS image + - name: Push AWS Static image to Docker Hub + uses: docker/build-push-action@v2 + with: + context: . + file: ./providers/aws/aws.dockerfile + push: true + tags: | + nitricimages/membrane-aws:latest + nitricimages/membrane-aws:${{ steps.tag.outputs.TAG }} + # Push GCP image + - name: Push GCP Static image to Docker Hub + uses: docker/build-push-action@v2 + with: + context: . + file: ./providers/gcp/gcp.dockerfile + push: true + tags: | + nitricimages/membrane-gcp:latest + nitricimages/membrane-gcp:${{ steps.tag.outputs.TAG }} + # Push Azure image + - name: Push Azure Static image to Docker Hub + uses: docker/build-push-action@v2 + with: + context: . + file: ./providers/azure/azure.dockerfile + push: true + tags: | + nitricimages/membrane-azure:latest + nitricimages/membrane-azure:${{ steps.tag.outputs.TAG }}