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: sync version in rockcraft.yaml when release #97

Merged
merged 1 commit into from
Jul 19, 2023
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
46 changes: 23 additions & 23 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: build
run-name: Build steps for ${{ github.sha }} on ${{ github.ref_name }}


on:
workflow_call:
outputs:
Expand All @@ -14,29 +14,29 @@ jobs:
outputs:
rock: ${{ steps.set.outputs.rock }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

- uses: canonical/craft-actions/rockcraft-pack@main
id: rockcraft
- name: Set rock output
id: set
run: echo "rock=${{ steps.rockcraft.outputs.rock }}" >> "$GITHUB_OUTPUT"

- uses: canonical/craft-actions/rockcraft-pack@main
id: rockcraft
- name: Set rock output
id: set
run: echo "rock=${{ steps.rockcraft.outputs.rock }}" >> "$GITHUB_OUTPUT"

- uses: actions/upload-artifact@v3
with:
path: ${{ steps.rockcraft.outputs.rock }}
name: ${{ steps.rockcraft.outputs.rock }}
- uses: actions/upload-artifact@v3
with:
path: ${{ steps.rockcraft.outputs.rock }}
name: ${{ steps.rockcraft.outputs.rock }}

- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Create SBOM
run: syft $(realpath ${{ steps.rockcraft.outputs.rock }}) -o spdx-json=identity_platform_login_ui.sbom.json
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin

- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
name: identity-platform-login-ui-sbom
path: "identity_platform_login_ui.sbom.json"
- name: Create SBOM
run: syft $(realpath ${{ steps.rockcraft.outputs.rock }}) -o spdx-json=identity_platform_login_ui.sbom.json

- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
name: identity-platform-login-ui-sbom
path: "identity_platform_login_ui.sbom.json"
28 changes: 14 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ name: ci
run-name: CI for ${{ github.sha }} on ${{ github.ref_name }}

on:
workflow_dispatch:
push:
branches:
- "main"
- "release-**"
tags:
- "v**"
pull_request:
branches:
- "*"
workflow_dispatch:
push:
branches:
- "main"
- "release-**"
tags:
- "v**"
pull_request:
branches:
- "*"

jobs:
unit-test:
uses: ./.github/workflows/unittest.yaml
build:
uses: ./.github/workflows/build.yaml
publish:
publish:
if: ${{ (github.ref == 'refs/heads/main') || (github.ref_type == 'tag') }}
needs: [build, unit-test]
needs: [ build, unit-test ]
uses: ./.github/workflows/publish.yaml
with:
rock: ${{ needs.build.outputs.rock }}
rock: ${{ needs.build.outputs.rock }}
scan:
if: ${{ (github.ref == 'refs/heads/main') || (github.ref_type == 'tag') }}
needs: publish
uses: ./.github/workflows/scan.yaml
with:
image: ${{ needs.publish.outputs.image }}
image: ${{ needs.publish.outputs.image }}
72 changes: 36 additions & 36 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ name: "CodeQL"

on:
push:
branches: [main]
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
branches: [ main ]
schedule:
- cron: '0 19 * * 4'

Expand All @@ -24,48 +24,48 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['go']
language: [ 'go' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout repository
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
77 changes: 46 additions & 31 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: container publish
run-name: Publish container from ${{ inputs.rock }} to ghcr.io/canonical/identity-platform-login-ui
name: image publish
run-name: Publish ROCK image from ${{ inputs.rock }} to ghcr.io/canonical/identity-platform-login-ui

on:
workflow_call:
Expand All @@ -19,32 +19,47 @@ jobs:
outputs:
image: ${{ steps.set.outputs.image }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.rock }}

- name: Install Skopeo
run: sudo snap install --devmode --channel edge skopeo

- name: Upload ROCK to ghcr.io with latest
id: latest
if: github.ref_type == 'branch'
run: |
sudo skopeo --insecure-policy copy oci-archive:$(realpath ./"${{ inputs.rock }}") docker://ghcr.io/canonical/identity-platform-login-ui:"${{ github.sha }}" --dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"
sudo skopeo --insecure-policy copy oci-archive:$(realpath ./"${{ inputs.rock }}") docker://ghcr.io/canonical/identity-platform-login-ui:latest --dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"
echo "image=ghcr.io/canonical/identity-platform-login-ui:${{ github.sha }}" >> "$GITHUB_ENV"
- name: Upload ROCK to ghcr.io with stable
id: stable
if: github.ref_type == 'tag'
run: |
sudo skopeo --insecure-policy copy oci-archive:$(realpath ./"${{ inputs.rock }}") docker://ghcr.io/canonical/identity-platform-login-ui:"${{ github.ref_name }}" --dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"
sudo skopeo --insecure-policy copy oci-archive:$(realpath ./"${{ inputs.rock }}") docker://ghcr.io/canonical/identity-platform-login-ui:stable --dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"
echo "image=ghcr.io/canonical/identity-platform-login-ui:${{ github.ref_name }}" >> "$GITHUB_ENV"
- name: Set output of image
id: set
run: echo "image=$image" >> "$GITHUB_OUTPUT"

- name: Checkout repository
uses: actions/checkout@v3

- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.rock }}

- name: Install Skopeo
run: sudo snap install --devmode --channel edge skopeo

- name: Upload ROCK to ghcr.io in latest channel
id: latest
if: ${{ github.ref_type }} == "branch"
run: |
versions=(latest "${{ github.sha }}")

for version in "${versions[@]}"; do
sudo skopeo --insecure-copy \
--dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
oci-archive:$(realpath ./"${{ inputs.rock }}") \
docker://ghcr.io/canonical/identity-platform-login-ui:"${version}"
done

echo "image=ghcr.io/canonical/identity-platform-login-ui:${{ github.sha }}" >> "$GITHUB_ENV"

- name: Upload ROCK to ghcr.io in stable channel
id: stable
if: ${{ github.ref_type }} == "tag"
run: |
versions=(stable "${{ github.ref_name }}")

for version in "${versions[@]}"; do
sudo skopeo --insecure-copy \
--dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
oci-archive:$(realpath ./"${{ inputs.rock }}") \
docker://ghcr.io/canonical/identity-platform-login-ui:"${version}"
done

echo "image=ghcr.io/canonical/identity-platform-login-ui:${{ github.ref_name }}" >> "$GITHUB_ENV"

- name: Set output of image
id: set
run: echo "image=$image" >> "$GITHUB_OUTPUT"
10 changes: 5 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
workflow_dispatch:
push:
branches:
- main
- "release-**"

- main
- "release-**"

jobs:
release-please:
Expand All @@ -19,15 +18,16 @@ jobs:
default-branch: main
pull-request-title-pattern: "ci: release ${version}"
token: ${{ secrets.PAT_TOKEN }}
extra-files: |
rockcraft.yaml
id: release
- uses: actions/checkout@v3
- name: Workaround for https://github.com/googleapis/release-please/issues/922
if: ${{ steps.release.outputs.pr != '' }}
if: ${{ steps.release.outputs.pr != '' }}
run: |
echo "Closing and reopening PR to trigger checks"
gh pr close ${{ fromJSON(steps.release.outputs.pr).number }} || true
gh pr reopen ${{ fromJSON(steps.release.outputs.pr).number }} || true
gh pr merge --auto --merge ${{ fromJSON(steps.release.outputs.pr).number }} || true
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}

20 changes: 10 additions & 10 deletions .github/workflows/scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Scan image with Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ inputs.image }}
format: 'sarif'
output: 'trivy-results.sarif'
- name: Scan image with Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ inputs.image }}
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload scan results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
- name: Upload scan results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
10 changes: 6 additions & 4 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: unit test
run-name: Unit test steps for ${{ github.sha }} on ${{ github.ref_name }}

on:
Expand All @@ -14,18 +15,19 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Build js UI
run: make npm-build

- name: Build Go code
run: make test

- uses: codecov/codecov-action@v3
with:
files: ./coverage.out
files: ./coverage.out

- name: Upload Go test results
uses: actions/upload-artifact@v3
with:
name: Go-results
path: test.json
path: test.json
2 changes: 1 addition & 1 deletion rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: identity-platform-login-ui

base: bare
build-base: ubuntu:22.04
version: '0.1'
version: '0.6.1' # x-release-please-version
wood-push-melon marked this conversation as resolved.
Show resolved Hide resolved
summary: Canonical Identity platform login UI
description: |
This is the Canonical Identity platform login UI used for connecting
Expand Down
Loading