Password policy #37
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_upload: | |
name: Build and upload 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/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
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/[email protected] | |
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@v4 | |
with: | |
name: netshot-dist | |
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_upload | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: netshot-dist | |
- name: Upload to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: "*.zip" | |
file_glob: true |