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

added Github Action for pack and store provider package in ghcr, and … #11

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
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
86 changes: 86 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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: make process.scheme

- 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;
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,20 @@ crossplane.help:
help-special: crossplane.help

.PHONY: crossplane.help help-special

JSON_FILE := scheme.json
check_file:
@if [ ! -f $(JSON_FILE) ]; then \
echo "File $(JSON_FILE) does not exist."; \
exit 1; \
fi
# Extract path keys and process them
process.scheme: check_file
@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 tolower($$2)}'); \
type=$$(echo "$$path" | awk -F/ '{print $$NF}'); \
type=$$(echo "$$type" | awk '{print toupper(substr($$0,1,1))tolower(substr($$0,2))}'); \
$(MAKE) provider.addtype provider=$$provider_name group=$$type kind=$$type apiversion=$$version; \
done
1 change: 1 addition & 0 deletions scheme.json

Large diffs are not rendered by default.

Loading