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

ci: use shared actions/workflows #9

Merged
merged 3 commits into from
Dec 12, 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
37 changes: 8 additions & 29 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,32 @@ name: Build

on:
pull_request: {}
workflow_dispatch:
inputs:
channel:
description: release channel
required: true
default: stable
version:
description: release version
required: true
default: current

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: setup Crossplane cli
uses: crossplane-contrib/xpkg-action@master
with:
channel: ${{ github.event.inputs.channel }}
version: ${{ github.event.inputs.version }}
command: -h

- name: move crossplane cli
run: "mkdir -p $TARGET_PATH && mv ./crossplane $TARGET_PATH"
env:
TARGET_PATH: "${{ github.workspace }}/bin"
uses: crossplane-contrib/setup-crossplane-action@b40ed901610103a85d38c838a1e00fc54eb8d4c5 # v0.1.0

- name: setup jsonnet-fmt
run: |
go install "github.com/google/go-jsonnet/cmd/[email protected]"
echo "$HOME/go/bin" >> "$GITHUB_PATH"
- name: setup go-jsonnet
uses: zendesk/setup-jsonnet@f683a0d16f479db69751bd8d3a49a09e22b45b39 # v12
with:
version: v0.20.0

- name: setup jrsonnet
uses: Duologic/tanka-exporter-workflow/.github/actions/jrsonnet-install@main
uses: grafana/shared-workflows/actions/setup-jrsonnet@main

- name: Build xpkg
run: "make -B build"
shell: bash
env:
CROSSPLANE: '${{ github.workspace }}/bin/crossplane'

- name: Check if file changed
id: changed
uses: tj-actions/verify-changed-files@v20
uses: tj-actions/verify-changed-files@6ed7632824d235029086612d4330d659005af687 # v20.0.1
with:
files: |
!bin
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
channel:
description: release channel
required: true
default: stable
version:
description: release version
required: true
default: current

env:
REGISTRY: ghcr.io
Expand All @@ -31,21 +21,17 @@ jobs:
uses: actions/checkout@v4

- name: setup Crossplane cli
uses: crossplane-contrib/xpkg-action@master
with:
channel: ${{ github.event.inputs.channel }}
version: ${{ github.event.inputs.version }}
command: -h
uses: crossplane-contrib/setup-crossplane-action@b40ed901610103a85d38c838a1e00fc54eb8d4c5 # v0.1.0

- name: Log in to the GitHub Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push xpkg
run: make push
if: ${{ github.ref == 'refs/heads/main' }} && env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
if: ${{ github.ref == 'refs/heads/main' }} && env.REGISTRY != ''
env:
CROSSPLANE: './crossplane'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LIBRARY_VERSION:=0.0.9
PROVIDER_VERSION:=0.21.0
JSONNET_BIN:=jrsonnet
CROSSPLANE?=crank
CROSSPLANE?=crossplane
REGISTRY?=ghcr.io
SHELL:=/bin/bash

Expand Down