Skip to content

Merge pull request #17 from odigos-io/dockerx-in-ci #42

Merge pull request #17 from odigos-io/dockerx-in-ci

Merge pull request #17 from odigos-io/dockerx-in-ci #42

Workflow file for this run

name: Release Demo Services
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
publish-docker-images:
strategy:
matrix:
include:
- service: coupon
- service: frontend
- service: inventory
- service: membership
- service: pricing
runs-on: ubuntu-latest
steps:
- name: Store new version in env
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image for ${{ matrix.service }}
uses: docker/build-push-action@v5
with:
push: true
tags: keyval/odigos-demo-${{ matrix.service }}:${{ env.TAG }}
platforms: linux/amd64,linux/arm64
file: ${{ matrix.service }}/Dockerfile
######################
#### MEMBERSHIP ####
######################
membership:
runs-on:
labels: ubuntu-latest
steps:
- name: Store new version in env
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.TAG }}
- name: Set env
id: vars
run: |
SHORT_COMMIT=$(git rev-parse --short HEAD)
echo "short_commit=${SHORT_COMMIT}" >> $GITHUB_ENV
- name: Install GemFury CLI
run: |
sudo bash -c "echo 'deb [trusted=yes] https://apt.fury.io/cli/ * *' > /etc/apt/sources.list.d/fury-cli.list"
sudo apt-get update
sudo apt-get install -y fury-cli
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Release Membership Linux Package
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
workdir: membership
env:
FURY_ACCOUNT: ${{ secrets.FURY_ACCOUNT }}
FURY_API_TOKEN: ${{ secrets.FURY_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
######################
#### FRONTEND ####
######################
frontend:
runs-on:
labels: ubuntu-latest
steps:
- name: Store new version in env
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.TAG }}
- name: Install GemFury CLI
run: |
sudo bash -c "echo 'deb [trusted=yes] https://apt.fury.io/cli/ * *' > /etc/apt/sources.list.d/fury-cli.list"
sudo apt-get update
sudo apt-get install -y fury-cli
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
- name: Release
working-directory: frontend
env:
FURY_ACCOUNT: ${{ secrets.FURY_ACCOUNT }}
FURY_API_TOKEN: ${{ secrets.FURY_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build -t frontend .
docker cp $(docker create --name tc frontend):/app ./dist && docker rm tc
sed -i -E 's/version: .*$/version: '"${TAG}"'/' nfpm.yaml
nfpm pkg --packager rpm --target dist/
nfpm pkg --packager deb --target dist/
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.rpm
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.deb
######################
#### INVENTORY ####
######################
inventory:
runs-on:
labels: ubuntu-latest
steps:
- name: Store new version in env
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.TAG }}
- name: Install GemFury CLI
run: |
sudo bash -c "echo 'deb [trusted=yes] https://apt.fury.io/cli/ * *' > /etc/apt/sources.list.d/fury-cli.list"
sudo apt-get update
sudo apt-get install -y fury-cli
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
- name: Release
working-directory: inventory
env:
FURY_ACCOUNT: ${{ secrets.FURY_ACCOUNT }}
FURY_API_TOKEN: ${{ secrets.FURY_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build -t inventory .
docker create --name tc inventory
mkdir -p ./dist/app
docker cp tc:/app ./dist/app
docker cp tc:/usr/local/lib/python3.11/site-packages ./dist/app/site-packages
docker rm tc
sed -i -E 's/version: .*$/version: '"${TAG}"'/' nfpm.yaml
nfpm pkg --packager rpm --target dist/
nfpm pkg --packager deb --target dist/
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.rpm
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.deb
######################
#### COUPON ####
######################
coupon:
runs-on:
labels: ubuntu-latest
steps:
- name: Store new version in env
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.TAG }}
- name: Install GemFury CLI
run: |
sudo bash -c "echo 'deb [trusted=yes] https://apt.fury.io/cli/ * *' > /etc/apt/sources.list.d/fury-cli.list"
sudo apt-get update
sudo apt-get install -y fury-cli
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
- name: Release
working-directory: coupon
env:
FURY_ACCOUNT: ${{ secrets.FURY_ACCOUNT }}
FURY_API_TOKEN: ${{ secrets.FURY_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build -t coupon .
docker create --name tc coupon
mkdir -p ./dist/app
docker cp tc:/app ./dist/app
docker rm tc
sed -i -E 's/version: .*$/version: '"${TAG}"'/' nfpm.yaml
nfpm pkg --packager rpm --target dist/
nfpm pkg --packager deb --target dist/
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.rpm
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.deb
######################
#### PRICING ####
######################
pricing:
runs-on:
labels: ubuntu-latest
steps:
- name: Store new version in env
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.TAG }}
- name: Install GemFury CLI
run: |
sudo bash -c "echo 'deb [trusted=yes] https://apt.fury.io/cli/ * *' > /etc/apt/sources.list.d/fury-cli.list"
sudo apt-get update
sudo apt-get install -y fury-cli
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
- name: Release
working-directory: pricing
env:
FURY_ACCOUNT: ${{ secrets.FURY_ACCOUNT }}
FURY_API_TOKEN: ${{ secrets.FURY_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build -t pricing .
docker create --name tc pricing
mkdir -p ./dist/app
docker cp tc:/app ./dist/app
docker rm tc
sed -i -E 's/version: .*$/version: '"${TAG}"'/' nfpm.yaml
nfpm pkg --packager rpm --target dist/
nfpm pkg --packager deb --target dist/
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.rpm
fury push --public --account $FURY_ACCOUNT --api-token $FURY_API_TOKEN dist/*.deb