Skip to content

Commit

Permalink
test workflow structure
Browse files Browse the repository at this point in the history
  • Loading branch information
erdrix committed Mar 8, 2024
1 parent f1bd235 commit 36fcf3e
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/iup-terraform-modules-oci-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "[IUP] - Terraform modules release on OCI"

on:
push:
# tags:
# - release_*

jobs:
terraform-modules-oci-release:
uses: ./.github/workflows/terraform-modules-oci-release.yml
with:
organization_layer_name: platform
team_name: infrastructure-utility-plane
products_path: "products"
57 changes: 57 additions & 0 deletions .github/workflows/terraform-modules-oci-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: " Terraform modules release on OCI"

permissions:
contents: write
pullRequests: write
issues: write

on:
workflow_call:
inputs:
runs-on:
required: false
type: string
default: ubuntu-latest
organization_layer_name:
required: false
type: string
default: platform
team_name:
required: true
type: string
products_path:
required: false
type: string
default: "products"


env:
REPOSITORY: "${{ github.event.repository.name }}"

jobs:
build-push:
runs-on: "${{ inputs.runs-on }}"
steps:
- uses: actions/checkout@v2
- uses: sigstore/cosign-installer@main
- uses: fluxcd/flux2/action@main
- name: Prepare tag
id: prepare_tag
run: |
VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}"
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=VERSION::${VERSION}
- name: Docker login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish OCI
run: |
echo "${{ steps.prep.outputs.VERSION }}"
ls -la "${{ inputs.organization_layer_name }}/${{ inputs.team_name }}/${{ inputs.products_path }}/**"
# bash -x ./publish-oci.sh ${{ steps.prep.outputs.VERSION }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
pushd .

REPOSITORY=konpyutaika/data-mesh

tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
cd $tmp_dir

git clone https://github.com/${REPO}
cd aws-primitive-modules

TAG=$(git rev-parse --short HEAD)
SOURCE="$(git config --get remote.origin.url)"
REVISION="$(git branch --show-current)/$(git rev-parse HEAD)"

rm -rf .git || true
rm -rf .github || true
rm Makefile
rm *.sh
rm $(find . -name "README.md")

flux push artifact \
oci://ghcr.io/${REPO}:$PROVIDER_VERSION-$TAG \
--path="./" \
--source=$SOURCE \
--revision=$REVISION

flux tag artifact \
oci://ghcr.io/${REPO}:$PROVIDER_VERSION-$TAG \
--tag latest

flux tag artifact \
oci://ghcr.io/${REPO}:$PROVIDER_VERSION-$TAG \
--tag $PROVIDER_VERSION-$1

rm -rf $tmp_dir

popd

0 comments on commit 36fcf3e

Please sign in to comment.