feat: build pricing for arm #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Demo Services | |
on: | |
pull_request: | |
branches: | |
- main | |
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 | |
context: ${{ matrix.service }} | |
###################### | |
#### 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 }} | |
############################## | |
#### Linux pkg via NPFM #### | |
############################## | |
linux-pkg: | |
strategy: | |
matrix: | |
include: | |
- service: frontend | |
arch: amd64 | |
pkg_arch: all | |
- service: inventory | |
arch: amd64 | |
pkg_arch: all | |
- service: coupon | |
arch: amd64 | |
pkg_arch: all | |
- service: pricing | |
arch: amd64 | |
pkg_arch: amd64 | |
- service: pricing | |
arch: arm64 | |
pkg_arch: arm64 | |
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 up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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: ${{ matrix.service }} | |
env: | |
FURY_ACCOUNT: ${{ secrets.FURY_ACCOUNT }} | |
FURY_API_TOKEN: ${{ secrets.FURY_API_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
docker buildx build --load --platform=linux/${{ matrix.arch }} -t ${{ matrix.service }} . | |
docker create --name tc ${{ matrix.service }} | |
mkdir -p ./dist/app | |
sh ./distribution/copy-assets.sh | |
docker rm tc | |
sed -i -E 's/version: .*$/version: '"${TAG}"'/' nfpm.yaml | |
sed -i -E 's/arch: .*$/arch: '"${{ matrix.pkg_arch }}"'/' 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 |