Skip to content

Commit

Permalink
added Github Action for pack and store provider package in ghcr, and …
Browse files Browse the repository at this point in the history
…generate magento types
  • Loading branch information
ca7alindev committed Jun 11, 2024
1 parent 02ff1f5 commit 41c7316
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Release builds

on:
push:
tags:
- '*'

jobs:
build-and-pack:
name: Build and pack
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: CR authentication
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set VERSION env
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Find the Go Build Cache
id: go
run: echo "::set-output name=cache::$(make go.cachedir)"

- name: Cache the Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-publish-artifacts-

- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

- name: Vendor Dependencies
run: make vendor vendor.check

- name: Get make submodules
run: make submodules

- name: Process swagger.json
run: |
#!/bin/bash
JSON_FILE="scheme.json"
if [ ! -f "$JSON_FILE" ]; then
echo "File $JSON_FILE does not exist."
exit 1
fi
path_keys=$(jq -r '.paths | keys[]' "$JSON_FILE" | grep -v '{')
for path in $path_keys; do
provider_name="magento.web7.md"
version=$(echo "$path" | awk -F/ '{print $2}')
type=$(echo "$path" | awk -F/ '{print $NF}')
type=$(echo "${type^}")
make provider.addtype provider=${provider_name} group=${version} kind=${type}
done
- name: Install crossplane CLI
id: crossplane
run: curl -sL "https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh" | sh

- name: Build provider image
run: docker build -t ${REGISTRY}/${{ github.repository }}/provider-magento:${{ env.VERSION }} ./cluster

- name: Build and push crossplane packages
run: ./crossplane xpkg build -f package -o provider-magento --embed-runtime-image ${REGISTRY}/${{ github.repository }}/provider-magento:${{ env.VERSION }} && ./crossplane xpkg push -f provider-magento ${REGISTRY}/${{ github.repository }}/provider-magento:${{ env.VERSION }} || true || true;
1 change: 1 addition & 0 deletions scheme.json

Large diffs are not rendered by default.

0 comments on commit 41c7316

Please sign in to comment.