Skip to content

Nightly Release to PowerShell Gallery and Docker Hub #1219

Nightly Release to PowerShell Gallery and Docker Hub

Nightly Release to PowerShell Gallery and Docker Hub #1219

name: Nightly Release to PowerShell Gallery and Docker Hub
on:
workflow_dispatch:
schedule:
- cron: '30 2 * * *'
jobs:
build:
runs-on: windows-latest
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
7.x
- uses: actions/checkout@v4
with:
ref: dev
token: ${{ secrets.PAT }}
- name: Build and Publish Module
env:
POWERSHELLGALLERY_API_KEY: ${{ secrets.POWERSHELLGALLERY_API_KEY }}
shell: pwsh
run: |
./build/Build-Nightly.ps1
- name: Set variables
shell: pwsh
run: |
$version = Get-Content version.txt -raw
"BUILDVERSION=$version" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
- name: Add & Commit
uses: EndBug/add-and-commit@v9
with:
message: 'Nightly publish to PowerShell Gallery'
tag: '${{env.BUILDVERSION}}-nightly --force'
push: true
publish-docker-windows-2022:
runs-on: windows-2022
needs: [ build ]
steps:
- uses: actions/checkout@v4
- name: Build an image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=nanoserver-ltsc2022" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-ltsc2022";
- name: Push the image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-ltsc2022"
publish-docker-windows-2019:
runs-on: windows-2019
needs: [ build ]
steps:
- uses: actions/checkout@v4
- name: Build an image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=nanoserver-1809" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-1809";
- name: Push the image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-1809"
publish-docker-linux:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/checkout@v4
- name: Build an image
run: |
VERSION=$(cat ./version.txt)-nightly
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=alpine-3.14" --build-arg "INSTALL_USER=root" --build-arg "SKIP_PUBLISHER_CHECK=False" ./docker -f ./docker/pnppowershell.dockerFile --tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.14;
- name: Tag the image
run: |
VERSION=$(cat ./version.txt)-nightly
docker image tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.14 ${{ secrets.DOCKER_ORG }}/powershell:nightly
- name: Push the image
run: |
VERSION=$(cat ./version.txt)-nightly
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.14
docker push ${{ secrets.DOCKER_ORG }}/powershell:nightly