Skip to content

Commit

Permalink
fix(Workflows): Fixed the publish CI/CD pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cdavernas committed Sep 2, 2024
1 parent 3a29e75 commit 04c06e5
Showing 1 changed file with 110 additions and 42 deletions.
152 changes: 110 additions & 42 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ jobs:
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
images: ${{ env.REGISTRY }}/${{ github.repository }}/api
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: './src/apps/Synapse.Server/Dockerfile'
file: './src/api/Synapse.Api.Server/Dockerfile'
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
publish-worker-image:

publish-operator-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -70,21 +70,49 @@ jobs:
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}-worker
images: ${{ env.REGISTRY }}/${{ github.repository }}/operator
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: './src/apps/Synapse.Worker/Dockerfile'
file: './src/operator/Synapse.Operator/Dockerfile'
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

publish-correlator-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/correlator
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: './src/correlator/Synapse.Correlator/Dockerfile'
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

publish-server-bin:
name: Release Server Binaries
name: Release API Binaries
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
Expand All @@ -105,16 +133,16 @@ jobs:
- name: Setup
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.0x
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="synapse-${{ matrix.target }}"
release_name="api-${{ matrix.target }}"
# Publish
dotnet publish src/apps/Synapse.Server/Synapse.Server.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
dotnet publish src/api/Synapse.Api.Server/Synapse.Api.Server.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack for Windows
Expand All @@ -128,12 +156,12 @@ jobs:
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "synapse*"
files: "api*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-worker-bin:
name: Release Worker Binaries
publish-operator-bin:
name: Release Operator Binaries
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
Expand All @@ -154,16 +182,16 @@ jobs:
- name: Setup
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.0x
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="synapse-worker-${{ matrix.target }}"
release_name="operator-${{ matrix.target }}"
# Publish
dotnet publish src/apps/Synapse.Worker/Synapse.Worker.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:PublishSingleFile=true
dotnet publish src/operator/Synapse.Operator/Synapse.Operator.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack for Windows
Expand All @@ -177,12 +205,12 @@ jobs:
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "synapse-worker*"
files: "operator*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-cli-bin:
name: Release CLI Binaries

publish-correlator-bin:
name: Release Correlator Binaries
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
Expand All @@ -203,16 +231,16 @@ jobs:
- name: Setup
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.0x
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="synctl-${{ matrix.target }}"
release_name="correlator-${{ matrix.target }}"
# Publish
dotnet publish src/apps/Synapse.Cli/Synapse.Cli.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:PublishSingleFile=true -p:GenerateDocumentationFile=false
dotnet publish src/correlator/Synapse.Correlator/Synapse.Correlator.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack for Windows
Expand All @@ -226,64 +254,104 @@ jobs:
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "synctl*"
files: "correlator*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-eventstore-plugin:
runs-on: ubuntu-latest

publish-runner-bin:
name: Release Runner Binaries
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
- kind: windows
os: windows-latest
target: win-x64
- kind: macOS
os: macos-latest
target: osx-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.0x
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="EventStoreRepositoryPlugin"
release_name="synapse-runner-${{ matrix.target }}"
# Publish
dotnet publish src/plugins/persistence/Synapse.Plugins.Persistence.EventStore/Synapse.Plugins.Persistence.EventStore.csproj -c Release -o "${release_name}"
dotnet publish src/runner/Synapse.Runner/Synapse.Runner.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:PublishSingleFile=true
# Pack
tar czvf "${release_name}.tar.gz" "${release_name}"
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
# Pack for other OS
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "${release_name}"
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "EventStoreRepositoryPlugin*"
files: "synapse-runner*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-mongodb-plugin:
runs-on: ubuntu-latest
publish-cli-bin:
name: Release CLI Binaries
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
- kind: windows
os: windows-latest
target: win-x64
- kind: macOS
os: macos-latest
target: osx-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.0x
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="MongoDBRepositoryPlugin"
release_name="synctl-${{ matrix.target }}"
# Publish
dotnet publish src/plugins/persistence/Synapse.Plugins.Persistence.MongoDB/Synapse.Plugins.Persistence.MongoDB.csproj -c Release -o "${release_name}"
dotnet publish src/cli/Synapse.Cli/Synapse.Cli.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:PublishSingleFile=true -p:GenerateDocumentationFile=false
# Pack
tar czvf "${release_name}.tar.gz" "${release_name}"
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
# Pack for other OS
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "${release_name}"
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "MongoDBRepositoryPlugin*"
files: "synctl*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 04c06e5

Please sign in to comment.