diff --git a/.github/workflows/iup-terraform-modules-oci-release.yml b/.github/workflows/iup-terraform-modules-oci-release.yml new file mode 100644 index 0000000..36d0d9d --- /dev/null +++ b/.github/workflows/iup-terraform-modules-oci-release.yml @@ -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" \ No newline at end of file diff --git a/.github/workflows/terraform-modules-oci-release.yml b/.github/workflows/terraform-modules-oci-release.yml new file mode 100644 index 0000000..9dbe108 --- /dev/null +++ b/.github/workflows/terraform-modules-oci-release.yml @@ -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 }} diff --git a/platform/infrastructure-utility-plane/products/infraform/publish-oci.sh b/platform/infrastructure-utility-plane/products/infraform/publish-oci.sh new file mode 100644 index 0000000..dbba50a --- /dev/null +++ b/platform/infrastructure-utility-plane/products/infraform/publish-oci.sh @@ -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 \ No newline at end of file