Skip to content

Revert "bump version" #38

Revert "bump version"

Revert "bump version" #38

Workflow file for this run

name: Release
on:
push:
branches: [main]
tags: ['[0-9]+.[0-9]+.[0-9]+']
pull_request:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
artifact: viking-linux-amd64
ext: tar.gz
- os: macos-latest
artifact: viking-macos-universal
ext: tar.gz
- os: windows-latest
artifact: viking-windows-amd64
ext: zip
runs-on: ${{ matrix.os }}
env:
VIKING_DATA_DIR: ${{ github.workspace }}/.viking-data
VIKING_TEST: "1"
steps:
- uses: actions/checkout@v4
- uses: jiro4989/setup-nim-action@v2
with:
nim-version: stable
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
nimble install -y --depsOnly
nimble setup -y
echo '--path:"src"' >> nimble.paths
- name: Build
run: nimble build -y -d:release -d:NimblePkgVersion=${{ github.ref_type == 'tag' && github.ref_name || 'dev' }}
- name: Build x86_64 and create universal binary (macOS)
if: runner.os == 'macOS'
run: |
mv viking viking-arm64
rm -rf ~/.cache/nim/viking_r
nim c -d:release -d:NimblePkgVersion=${{ github.ref_type == 'tag' && github.ref_name || 'dev' }} --passC:"-arch x86_64" --passL:"-arch x86_64" --cpu:amd64 -o:viking-x86_64 src/viking.nim
lipo -create viking-arm64 viking-x86_64 -output viking
file viking
- name: Cache ERiC library
uses: actions/cache@v4
with:
path: ${{ env.VIKING_DATA_DIR }}
key: eric-${{ runner.os }}-${{ runner.arch }}
- name: Fetch ERiC
run: ./viking fetch
- name: Download ELSTER test certificate
shell: bash
run: |
mkdir -p "$VIKING_DATA_DIR/certificates"
curl -sSL -o "$RUNNER_TEMP/Test_Zertifikate.zip" https://download.elster.de/download/schnittstellen/Test_Zertifikate.zip
unzip -o -d "$VIKING_DATA_DIR/certificates" "$RUNNER_TEMP/Test_Zertifikate.zip"
- name: Run tests
run: nimble test
- name: Package (Unix)
if: matrix.ext == 'tar.gz'
run: |
mkdir -p ${{ matrix.artifact }}
cp viking ${{ matrix.artifact }}/
cp README.md LICENSE ${{ matrix.artifact }}/
tar czf ${{ matrix.artifact }}.${{ matrix.ext }} ${{ matrix.artifact }}
- name: Package (Windows)
if: matrix.ext == 'zip'
shell: pwsh
run: |
New-Item -ItemType Directory -Path ${{ matrix.artifact }}
Copy-Item viking.exe ${{ matrix.artifact }}/
Copy-Item README.md, LICENSE ${{ matrix.artifact }}/
Compress-Archive -Path ${{ matrix.artifact }} -DestinationPath ${{ matrix.artifact }}.${{ matrix.ext }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}.${{ matrix.ext }}
release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} \
--repo ${{ github.repository }} \
--title "${{ github.ref_name }}" \
--generate-notes \
viking-linux-amd64.tar.gz \
viking-macos-universal.tar.gz \
viking-windows-amd64.zip