Skip to content

Update Artifact release wction #1

Update Artifact release wction

Update Artifact release wction #1

name: release-genval-artifacts
on:
push:
tags:
- 'v*'
contents: write
security-events: write
# Optional: allow read access to pull request. Use with `only-new-issues` option.
packages: write
jobs:
push-artifact:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.22'
cache: false
- name: install genval
run: go install github.com/intelops/genval@main
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch Git tag
id: get_tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
# Publish Genval Rego polcies
- name: Push Dockerfile policies
id: push_dockerfile_policies
if: ${{ contains(github.event.head.commit_modified, 'genval/defaultpolicies/rego/dockerfile_policies/**') }}
run: |
GIT_TAG=${{ env.tag }}
GENVAL_OUTPUT=$(genval artifact push --reqinput ./genval/defaultpolicies/rego/dockerfile_policies\ \
--dest oci://ghcr.io/intelops/policyhub/genval/dockerfile_policies:${GIT_TAG} \
--annotations="authors=intelops inc")
echo "${GENVAL_OUTPUT}"
echo "dockerfile_artifact_url=oci://ghcr.io/intelops/policyhub/genval/dockerfile_policies:${GIT_TAG}" >> $GITHUB_ENV
- name: Use Dockerfile URL
run: |
echo "Dockerfile artifact URL: ${{ env.dockerfile_artifact_url }}"
- name: Push Dockerfile Input policies
id: push_dockerfile_input_policies
if: ${{ contains(github.event.head.commit_modified, 'genval/defaultpolicies/rego/input_policies/**') }}
run: |
GIT_TAG=${{ env.tag }}
GENVAL_OUTPUT=$(genval artifact push --reqinput ./genval/defaultpolicies/rego/input_policies\ \
--dest oci://ghcr.io/intelops/policyhub/genval/dockerfile_input_policies:${GIT_TAG} \
--annotations="authors=intelops inc")
echo "${GENVAL_OUTPUT}"
echo "dockerfile_input_artifact_url=oci://ghcr.io/intelops/policyhub/genval/dockerfile_input_policies:${GIT_TAG}" >> $GITHUB_ENV
- name: Use Dockerfile Input URL
run: |
echo "Dockerfile artifact URL: ${{ env.dockerfile_input_artifact_url }}"
- name: Push Infrafile policies
id: push_infrafile_policies
if: ${{ contains(github.event.head.commit_modified, 'genval/defaultpolicies/rego/infrafile_policies/**') }}
run: |
GIT_TAG=${{ env.tag }}
GENVAL_OUTPUT=$(genval artifact push --reqinput ./genval/defaultpolicies/rego/infrafile_policies\ \
--dest oci://ghcr.io/intelops/policyhub/genval/infrafile_policies:${GIT_TAG} \
--annotations="authors=intelops inc)
echo "${GENVAL_OUTPUT}"
echo "infrafile_artifact_url=oci://ghcr.io/intelops/policyhub/genval/infrafile_policies:${GIT_TAG}" >> $GITHUB_ENV
- name: Use Dockerfile Input URL
run: |
echo "Dockerfile artifact URL: ${{ env.infrafile_artifact_url }}"
- name: Push Terraform policies
id: push_terraform_policies
if: ${{ contains(github.event.head.commit_modified, 'genval/defaultpolicies/rego/terrraform_policies/**') }}
run: |
GIT_TAG=${{ env.tag }}
GENVAL_OUTPUT=$(genval artifact push --reqinput ./genval/defaultpolicies/rego/terraform_policies\ \
--dest oci://ghcr.io/intelops/policyhub/genval/terraform_policies:${GIT_TAG} \
--annotations="authors=intelops inc")
echo "${GENVAL_OUTPUT}"
echo "terraform_artifact_url=oci://ghcr.io/intelops/policyhub/genval/terraform_policies:${GIT_TAG}" >> $GITHUB_ENV
- name: Use Dockerfile Input URL
run: |
echo "Dockerfile artifact URL: ${{ env.terraform_artifact_url }}"
# Publish Genval cuemods
- name: Push k8s module
id: push_k8s_module
if: ${{ contains(github.event.head.commit_modified, 'genval/modules/cuemod-k8s:*/**') }}
run: |
GIT_TAG=${{ env.tag }}
GENVAL_OUTPUT=$(genval artifact push --reqinput ./genval/modules/cuemod-k8s:v1.30 \
--dest oci://ghcr.io/intelops/policyhub/genval/k8s-cuemods:${GIT_TAG} \
--annotations="authors=intelops inc")
echo "${GENVAL_OUTPUT}"
echo "k8s-module_artifact_url=oci://ghcr.io/intelops/policyhub/genval/k8s-cuemods:${GIT_TAG}" >> $GITHUB_ENV
- name: Use Dockerfile Input URL
run: |
echo "Dockerfile artifact URL: ${{ env.k8s_module_artifact_url }}"
- name: Push ArgoCD module
id: push_argocd_module
if: ${{ contains(github.event.head.commit_modified, 'genval/modules/cuemod-argocd:*/**') }}
run: |
GIT_TAG=${{ env.tag }}
GENVAL_OUTPUT=$(genval artifact push --reqinput ./genval/modules/cuemod-argocd:v2.11.3 \
--dest oci://ghcr.io/intelops/policyhub/genval/argocd-cuemods:$GIT_TAG} \
--annotations="authors=intelops Inc."
echo "${GENVAL_OUTPUT}"
echo "argocd_module_artifact_url=oci://ghcr.io/intelops/policyhub/genval/argocd-cuemods:$GIT_TAG}" >> $GITHUB_ENV
- name: Use Dockerfile Input URL
run: |
echo "Dockerfile artifact URL: ${{ env.argocd_module_artifact_url }}"
- name: Push TektonCD module
id: push_tektoncd_module
if: ${{ contains(github.event.head.commit_modified, 'genval/modules/cuemod-tektoncd:*/**') }}
run: |
GIT_TAG=${{ env.tag }}
GENVAL_OUTPUT=$(genval artifact push --reqinput ./genval/modules/cuemod-tektoncd:v0.60.2 \
--dest oci://ghcr.io/intelops/policyhub/genval/argocd-cuemods:$GIT_TAG} \
--annotations="authors=intelops Inc."
echo "${GENVAL_OUTPUT}"
echo "tektoncd_module_artifact_url=oci://ghcr.io/intelops/policyhub/genval/tektoncd-cuemods:$GIT_TAG}" >> $GITHUB_ENV
- name: Use Dockerfile Input URL
run: |
echo "Dockerfile artifact URL: ${{ env.tektoncd_module_artifact_url }}"