Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Overhaul the GitHub workflow to build docker image and then proceed with semantic release generation #2

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 76 additions & 35 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -4,60 +4,101 @@ on:
push:
branches: [ "main" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:

build:
name: "Build docker image"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: "Cache docker layers"
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: "Docker meta"
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
tags: latest

- name: Build DOTelL Docker image
uses: docker/build-push-action@v5
with:
push: false
outputs: type=docker,dest=/tmp/docker.tar
context: .
file: src/DOTelL.Api/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}

- name: "Upload Docker artifacts"
uses: actions/upload-artifact@v3
with:
name: docker
path: /tmp/docker.tar

release:
name: DOTelL semantic release
runs-on: ubuntu-latest
environment:
name: production
url: https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic-release.outputs.release-tag }}
needs:
- build

permissions:
contents: write
issues: write
pull-requests: write
packages: write

steps:
- name: Checkout
- name: "Checkout"
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@v3
- name: "Download docker artifacts"
uses: actions/download-artifact@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
name: docker
path: /tmp

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: "Load docker tag"
run: |
docker load --input /tmp/docker.tar
docker image ls -a
- name: Semantic release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 22.0.5
dry_run: true
extra_plugins: |
@semantic-release/commit-analyzer@11.0.0
@semantic-release/release-notes-generator@12.0.0
@semantic-release/changelog@6.0.3
@semantic-release/github@9.2.1
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'next-major',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
- name: "Create release"
id: semantic-release
uses: docker://ghcr.io/open-sauced/release:2.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_NPM_PUBLISH: true

- name: "Show release output"
run: |
echo ${{ env.RELEASE_TAG }}
echo ${{ env.RELEASE_VERSION }}

22 changes: 0 additions & 22 deletions .releaserc.json

This file was deleted.