Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
42 changes: 40 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,52 @@
name: Continuous Integration

on:
pull_request:
branches:
- main

jobs:
build:
build-docker:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build service
run: docker build .

build-windows:
name: Build Windows executable
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Perl for Windows build
if: ${{ steps.release.outputs.release_created }}
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: "5.42"
Comment thread
jef marked this conversation as resolved.
Outdated

- name: Install Perl dependencies for Windows build
if: ${{ steps.release.outputs.release_created }}
Comment thread
jef marked this conversation as resolved.
Outdated
Comment thread
jef marked this conversation as resolved.
Outdated
run: |
cpanm --notest PAR::Packer
cpanm --notest Compress::Zlib
cpanm --notest Encode
cpanm --notest File::Basename
cpanm --notest File::Copy
cpanm --notest Getopt::Std
cpanm --notest HTTP::Cookies
cpanm --notest URI
cpanm --notest URI::Escape
cpanm --notest LWP::UserAgent
cpanm --notest LWP::ConnCache
cpanm --notest POSIX
cpanm --notest Time::Local
cpanm --notest Time::Piece
cpanm --notest JSON

- name: Build Windows executable
run: pp -o zap2xml.exe zap2xml.pl
38 changes: 20 additions & 18 deletions .github/workflows/nightly-release.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
name: Nightly Release

on:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"
workflow_dispatch: {}

jobs:
check-date:
name: Check dates
nightly-release:
name: Nightly Build and Release Docker image (if code changed in 24h)
runs-on: ubuntu-latest
outputs:
should-run: ${{ steps.code-change.outputs.should-run }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check if code has changed with 24 hours
continue-on-error: true
uses: actions/checkout@v4

- name: Check if code has changed within 24 hours
id: code-change
run: |
[[ $(git rev-list --after="24 hours" --first-parent HEAD) ]] && echo "::set-output name=should-run::true"
build-release:
name: Build and release Docker image
runs-on: ubuntu-latest
needs: check-date
if: needs.check-date.outputs.should-run == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v2
if [[ $(git rev-list --after="24 hours" --first-parent HEAD) ]]; then
echo "should-run=true" >> $GITHUB_OUTPUT
else
echo "should-run=false" >> $GITHUB_OUTPUT
fi

- name: Login into GitHub Container Registry
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
if: steps.code-change.outputs.should-run == 'true'
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin

- name: Build Docker image
if: steps.code-change.outputs.should-run == 'true'
run: |
docker build \
-t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \
-t "ghcr.io/${GITHUB_REPOSITORY}:nightly" .

- name: Release Docker image
if: steps.code-change.outputs.should-run == 'true'
run: |
docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}"
docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly"
43 changes: 41 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,60 @@ on:

jobs:
build-tag-release:
name: Build, tag, and release Docker image
name: Build, tag, and release Docker image and Windows executable
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup release please
uses: google-github-actions/release-please-action@v2
uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
changelog-path: CHANGELOG.md
package-name: zap2xml

- name: Setup Perl for Windows build
if: ${{ steps.release.outputs.release_created }}
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: "5.42"
Comment thread
jef marked this conversation as resolved.
Outdated

- name: Install Perl dependencies for Windows build
if: ${{ steps.release.outputs.release_created }}
run: |
cpanm --notest PAR::Packer
cpanm --notest Compress::Zlib
cpanm --notest Encode
cpanm --notest File::Basename
cpanm --notest File::Copy
cpanm --notest Getopt::Std
cpanm --notest HTTP::Cookies
cpanm --notest URI
cpanm --notest URI::Escape
cpanm --notest LWP::UserAgent
cpanm --notest LWP::ConnCache
cpanm --notest POSIX
cpanm --notest Time::Local
cpanm --notest Time::Piece
cpanm --notest JSON
Comment thread
jef marked this conversation as resolved.

- name: Build Windows executable
if: ${{ steps.release.outputs.release_created }}
run: pp -o zap2xml.exe zap2xml.pl

- name: Upload Windows executable to release
if: ${{ steps.release.outputs.release_created }}
run: |
curl -X POST \
Comment thread
jef marked this conversation as resolved.
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/octet-stream" \
--data-binary @zap2xml.exe \
"${{ steps.release.outputs.upload_url }}?name=zap2xml.exe&label=Windows%20Executable"

- name: Login into GitHub Container Registry
if: ${{ steps.release.outputs.release_created }}
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
Expand Down
Loading