Add compliance status to light device API lists #21
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: Build and publish Docker and zip archive | |
on: | |
push: | |
branches: | |
- master | |
release: | |
types: | |
- created | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-publish: | |
name: Create and publish the files | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3.0.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5.0.0 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
labels: | | |
org.opencontainers.image.title=Netshot | |
org.opencontainers.image.description=Network Configuration and Compliance Management Software | |
org.opencontainers.image.vendor=Netshot | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Build and push the image | |
uses: docker/build-push-action@v5.0.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
NETSHOT_VERSION=${{ steps.meta.outputs.version }} | |
- name: Extract Netshot JAR | |
uses: shrink/actions-docker-extract@v3 | |
id: extract | |
with: | |
image: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} | |
path: /usr/local/netshot/netshot.jar | |
- name: Prepare ZIP archive | |
run: | | |
mkdir zip | |
cd zip | |
cp ../dist/* . | |
cp ../src/main/resources/www/LICENSE.txt . | |
cp ../${{ steps.extract.outputs.destination }}/netshot.jar . | |
echo ${{ steps.meta.outputs.version }} > VERSION.txt | |
zip netshot_${{ steps.meta.outputs.version }}.zip * | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: netshot-zip | |
path: zip/netshot_${{ steps.meta.outputs.version }}.zip | |
attach-to-release: | |
name: Attach archive to GitHub release | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: build-and-publish | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: netshot-zip | |
- name: Upload to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: "*.zip" | |
file_glob: true |