Skip to content

Commit 41c7316

Browse files
committed
added Github Action for pack and store provider package in ghcr, and generate magento types
1 parent 02ff1f5 commit 41c7316

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/release.yaml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release builds
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-and-pack:
10+
name: Build and pack
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: CR authentication
17+
uses: docker/login-action@v2
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.ACCESS_TOKEN }}
22+
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 2
27+
- name: Configure Git
28+
run: |
29+
git config user.name "$GITHUB_ACTOR"
30+
git config user.email "$GITHUB_ACTOR@github.com"
31+
32+
- name: Set VERSION env
33+
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
34+
35+
- name: Setup QEMU
36+
uses: docker/setup-qemu-action@v1
37+
with:
38+
platforms: all
39+
40+
- name: Setup Docker Buildx
41+
uses: docker/setup-buildx-action@v1
42+
with:
43+
version: ${{ env.DOCKER_BUILDX_VERSION }}
44+
install: true
45+
46+
- name: Setup Go
47+
uses: actions/setup-go@v2
48+
with:
49+
go-version: ${{ env.GO_VERSION }}
50+
51+
- name: Find the Go Build Cache
52+
id: go
53+
run: echo "::set-output name=cache::$(make go.cachedir)"
54+
55+
- name: Cache the Go Build Cache
56+
uses: actions/cache@v2
57+
with:
58+
path: ${{ steps.go.outputs.cache }}
59+
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
60+
restore-keys: ${{ runner.os }}-build-publish-artifacts-
61+
62+
- name: Cache Go Dependencies
63+
uses: actions/cache@v2
64+
with:
65+
path: .work/pkg
66+
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
67+
restore-keys: ${{ runner.os }}-pkg-
68+
69+
- name: Vendor Dependencies
70+
run: make vendor vendor.check
71+
72+
- name: Get make submodules
73+
run: make submodules
74+
75+
- name: Process swagger.json
76+
run: |
77+
#!/bin/bash
78+
JSON_FILE="scheme.json"
79+
if [ ! -f "$JSON_FILE" ]; then
80+
echo "File $JSON_FILE does not exist."
81+
exit 1
82+
fi
83+
path_keys=$(jq -r '.paths | keys[]' "$JSON_FILE" | grep -v '{')
84+
for path in $path_keys; do
85+
provider_name="magento.web7.md"
86+
version=$(echo "$path" | awk -F/ '{print $2}')
87+
type=$(echo "$path" | awk -F/ '{print $NF}')
88+
type=$(echo "${type^}")
89+
make provider.addtype provider=${provider_name} group=${version} kind=${type}
90+
done
91+
92+
- name: Install crossplane CLI
93+
id: crossplane
94+
run: curl -sL "https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh" | sh
95+
96+
- name: Build provider image
97+
run: docker build -t ${REGISTRY}/${{ github.repository }}/provider-magento:${{ env.VERSION }} ./cluster
98+
99+
- name: Build and push crossplane packages
100+
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;

scheme.json

+1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)