add private nuget feed #173
Workflow file for this run
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
name: 'docker release' | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
types: [ closed ] | |
env: | |
PRERELEASE_BRANCHES: experimental,alpha,beta,rc | |
DOCKER_IMAGE_REGISTRY_PATH: ${{ secrets.RAAEDGE_LOGIN_SERVER }}/connectors-opcua | |
COVERAGE_FOLDER: Coverage | |
jobs: | |
ci: | |
name: Release | |
runs-on: ubuntu-latest | |
env: | |
RELEASE: ${{ github.event_name == 'push' && contains(inputs.branches || 'main,master', github.ref_name) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: mathieudutour/[email protected] | |
name: Calculate next version and create tag on GitHub | |
id: tag | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_prefix: ${{ inputs.component && format('{0}/v',inputs.component) || 'v' }} | |
fetch_all_tags: true | |
release_branches: ${{ inputs.branches }} | |
dry_run: ${{ env.RELEASE != 'true' }} | |
- name: Add private Nuget feed | |
run: dotnet nuget add source --username ${{ secrets.NUGET_GITHUB_PACKAGES_USERNAME }} --password ${{ secrets.NUGET_GITHUB_PACKAGES_TOKEN }} --store-password-in-clear-text --name "githubpackagesnuget" "https://nuget.pkg.github.com/RaaLabs/index.json" | |
- name: Build Docker image | |
id: initial-build | |
uses: docker/build-push-action@v6 | |
with: | |
push: false | |
no-cache: true | |
context: . | |
file: ${{ inputs.dockerfile || 'Source/Dockerfile' }} | |
load: true | |
platforms: linux/amd64 | |
tags: image:local | |
build-args: | | |
BUILD_VERSION=${{ steps.tag.outputs.new_version }} | |
- name: Wiz scan the Docker Image for Vulnerabilities | |
id: wiz | |
env: | |
WIZ_CLIENT_ID: ${{ secrets.WIZ_CLIENT_ID }} | |
WIZ_CLIENT_SECRET: ${{ secrets.WIZ_CLIENT_SECRET }} | |
run: | | |
echo "Runs the Wiz Cli with a relaxed policy that shows only that have a fix available." | |
echo "Policy does not block the pipeline... yet!" | |
curl -o wizcli https://downloads.wiz.io/wizcli/latest/wizcli-linux-amd64 && chmod +x wizcli | |
./wizcli auth --id "$WIZ_CLIENT_ID" --secret "$WIZ_CLIENT_SECRET" | |
./wizcli docker scan --image ${{ steps.initial-build.outputs.imageid }} --policy "Relaxed Vulnerabilities Policy" | |
- name: Apply version tag to Docker images | |
id: references | |
run: | | |
echo ${{ github.event_name }} | |
IMAGES=$(tr "," "\n" <<<"${{ inputs.images }}" | sed "s/^[[:space:]]*//;s/[[:space:]]*$//") | |
echo -e "Images to tag:\n$IMAGES" | |
REFS=$(sed "s/$/:v${{ steps.tag.outputs.new_version }}/" <<<"$IMAGES" | paste -sd "," -) | |
echo -e "References: $REFS" | |
echo "tags=$REFS" >> $GITHUB_OUTPUT | |
- uses: azure/docker-login@v2 | |
if: ${{ env.RELEASE == 'true' && contains(inputs.images, 'raaedge.azurecr.io') }} | |
with: | |
login-server: ${{ secrets.RAAEDGE_LOGIN_SERVER }} | |
username: ${{ secrets.RAAEDGE_ACR_USERNAME }} | |
password: ${{ secrets.RAAEDGE_ACR_PASSWORD }} | |
- name: Push Docker images | |
uses: docker/build-push-action@v6 | |
if: ${{ env.RELEASE == 'true' }} | |
with: | |
push: true | |
context: . | |
file: ${{ inputs.dockerfile || 'Source/Dockerfile' }} | |
platforms: linux/amd64 | |
tags: ${{ steps.references.outputs.tags }} | |
build-args: | | |
BUILD_VERSION=${{ steps.tag.outputs.new_version }} | |
- name: Make GitHub Release | |
if: ${{ env.RELEASE == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create ${{ steps.tag.outputs.new_tag }} --target=${{ github.sha }} --title="${{ inputs.component && format('{0} - ',inputs.component) || '' }}v${{ steps.tag.outputs.new_version }}" --notes="${{ steps.tag.outputs.changelog }}" |