-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename workflows, only make policy releases on tags
- Loading branch information
1 parent
d72da73
commit 6a9d5d4
Showing
2 changed files
with
7 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ jobs: | |
uses: actions/[email protected] | ||
|
||
- name: Setup OPA | ||
uses: open-policy-agent/setup-opa@v2 | ||
uses: open-policy-agent/setup-opa@v2.1.0 | ||
with: | ||
version: latest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ name: Policy Container | |
|
||
on: | ||
push: | ||
branches: # Release only when main advances | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build_publish: | ||
# Deduplicate jobs from pull requests and branch pushes within the same repo. | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
@@ -18,9 +19,6 @@ jobs: | |
- name: Generate Image Name | ||
run: echo IMAGE_REPOSITORY=ghcr.io/$(echo "${{ github.repository }}-policy" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV | ||
|
||
- name: Generate Image Tag # :<tag> or :latest if not tagged | ||
run: echo IMAGE_TAG=$(echo "${{ github.ref_type }} = 'tag' && ${{ github.ref_name }} || 'latest'" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV | ||
|
||
- name: Log in to GitHub Docker Registry | ||
uses: docker/[email protected] | ||
with: | ||
|
@@ -29,12 +27,13 @@ jobs: | |
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup OPA | ||
uses: open-policy-agent/setup-opa@v2 | ||
uses: open-policy-agent/setup-opa@v2.1.0 | ||
with: | ||
version: latest | ||
|
||
- name: Build & Publish OPA Policy | ||
run: opa build ./org-policy | ||
|
||
- name: Publish OPA Policy | ||
run: oras push ${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }} --config ./org-policy/config.json:application/vnd.oci.image.config.v1+json bundle.tar.gz:application/vnd.oci.image.layer.v1.tar+gzip | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | ||
run: oras push ${{ env.IMAGE_REPOSITORY }}:${{ github.ref_name }} --config ./org-policy/config.json:application/vnd.oci.image.config.v1+json bundle.tar.gz:application/vnd.oci.image.layer.v1.tar+gzip |