Skip to content

0-build-snapshot-win #7

0-build-snapshot-win

0-build-snapshot-win #7

name: 0-build-snapshot-win
# 2025-04-20 01:20
on:
workflow_dispatch:
inputs:
archive_all:
description: archive_all
type: boolean
default: false
deploy_snapshot:
description: deploy_snapshot
type: boolean
default: false
create_SHA_all:
description: create_SHA_all
type: boolean
default: false
required: true
LAZARUS_VERSION:
description: LAZARUS_VERSION (default stable, try 3.0RC2)
default: 'stable'
required: true
workflow_call:
# push:
# paths:
# - 'components/**'
# - 'plugins/**'
# - 'sdk/**'
# - 'src/**'
# branches:
# - master
env:
TAG_NAME: "doublecmd-win"
TAG_REF: "0000000"
#concurrency:
# group: ${{ github.ref }}
# cancel-in-progress: true
jobs:
build-win:
runs-on: windows-latest
steps:
- name: show public IP
shell: bash
run: |
public_ip=$(curl ipinfo.io/ip)
echo "IP:$public_ip:"
- name: Checkout source
uses: deep-soft/checkout@v4
with:
fetch-depth: 0
- name: Set DC_VER
shell: bash
run: |
# set -x;
_version_major_=$(grep "MajorVersionNr Value=" src/doublecmd.lpi | awk -F = '{print $2}' | awk -F / '{print $1}' | tr -d '"' ) || true;
_version_minor_=$(grep "MinorVersionNr Value=" src/doublecmd.lpi | awk -F = '{print $2}' | awk -F / '{print $1}' | tr -d '"' ) || true;
_version_micro_=$(grep "RevisionNr Value=" src/doublecmd.lpi | awk -F = '{print $2}' | awk -F / '{print $1}' | tr -d '"' ) || true;
echo "_version_major_ = $_version_major_";
echo "_version_minor_ = $_version_minor_";
echo "_version_micro_ = $_version_micro_";
if [[ "$_version_major_" == "" ]]; then _version_major_=1; fi
if [[ "$_version_minor_" == "" ]]; then _version_minor_=2; fi
if [[ "$_version_micro_" == "" ]]; then _version_micro_=0; fi
_prog_version_="$_version_major_.$_version_minor_.$_version_micro_";
#_revision_=$(git -C $1 rev-list --count HEAD)
_ref_all_=$(git log -1 --format='%H')
# _ref_=$(echo ${_ref_all_::7})
_date_=$(date +%Y%m%d)
_ref_org_=${{ env.TAG_REF }}
_ref_len_="${#_ref_org_}"
_ref_=$(echo ${_ref_all_::$_ref_len_})
_revision_=$_ref_
echo "DC_VER=$_prog_version_" >> $GITHUB_ENV;
echo "DC_REVISION=$_revision_" >> $GITHUB_ENV;
- name: Print DC_VER
shell: bash
run: |
echo "DC_VER=${{ env.DC_VER }}";
echo "DC_REVISION=${{ env.DC_REVISION }}";
- name: create SHA_SUMS
if: ${{ inputs.create_SHA_all }}
uses: deep-soft/sha-checksums@v1
with:
type: sha256
filename: '${{ env.TAG_NAME }}-${{ env.DC_VER }}-win.sha256'
directory: '.'
path: '.'
exclusions: '*node_modules* .editorconfig'
debug: true
ignore_git: true
# checksums filename is ${{ env.SHA_SUMS }}
- name: Upload artifact
if: ${{ inputs.create_SHA_all }}
continue-on-error: true
uses: deep-soft/upload-artifact@v4
with:
name: ${{ env.TAG_NAME }}-${{ env.DC_VER }}-win
path: ${{ env.SHA_SUMS }}
- name: Archive src Release
uses: deep-soft/zip-release@v2
with:
type: 'zip'
path: '.'
directory: '.'
filename: '${{ env.TAG_NAME }}-${{ env.DC_VER }}-${{ env.DC_REVISION }}-src-win.zip'
exclusions: '*.git* /*node_modules/* .editorconfig doublecmd-release/* doublecmd.app'
- name: list Archive src
run: |
echo 'arc name: ' ${{ env.ZIP_RELEASE_ARCHIVE }}
ls -l ${{ env.ZIP_RELEASE_ARCHIVE }}
- name: create release SHA_SUMS
uses: deep-soft/sha-checksums@v1
with:
type: sha256
filename: '${{ env.TAG_NAME }}-${{ env.DC_VER }}-win-zip.sha256'
directory: '.'
path: "${{ env.ZIP_RELEASE_ARCHIVE }}"
exclusions: '*node_modules* .editorconfig'
debug: true
ignore_git: true
# checksums filename is ${{ env.SHA_SUMS }}
# - name: Publish source Release
# if: publish-source-archive
# continue-on-error: true
# uses: deep-soft/action-gh-release@v2.1
# with:
# draft: true
# tag_name: ${{ env.TAG_NAME }}-${{ env.DC_VER }}-${{ env.DC_REVISION }}-win
# files: |
# ${{ env.ZIP_RELEASE_ARCHIVE }}
# ${{ env.SHA_SUMS }}
- name: Set version to Install Free Pascal
shell: bash
run: |
echo "LAZARUS_VERSION=stable" >> $GITHUB_ENV
if [[ "${{ inputs.LAZARUS_VERSION }}" != "" ]]; then
LAZARUS_VERSION="${{ inputs.LAZARUS_VERSION }}";
else
LAZARUS_VERSION="stable";
fi
echo "LAZARUS_VERSION=$LAZARUS_VERSION"
echo "LAZARUS_VERSION=$LAZARUS_VERSION" >> $GITHUB_ENV
- name: Install Lazarus
uses: deep-soft/lazarus-install@win
# lazarus-version: "2.2.6"
# lazarus-version: "stable"
with:
lazarus-version: "${{ env.LAZARUS_VERSION }}"
- name: Build packages
shell: cmd
run: |
call .github/scripts/create_snapshot_pv.bat
- name: Publish Release
continue-on-error: true
uses: deep-soft/action-gh-release@v2.1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}-${{ env.DC_VER }}-${{ env.DC_REVISION }}-win
files: |
./doublecmd-release/*.7z
./doublecmd-release/*.txt
${{ env.ZIP_RELEASE_ARCHIVE }}
${{ env.SHA_SUMS }}
- name: Publish Release latest
continue-on-error: true
uses: deep-soft/action-gh-release@v2.1
with:
draft: false
tag_name: ${{ env.TAG_NAME }}
files: |
./doublecmd-release/*.7z
./doublecmd-release/*.txt
- name: Prepare to deploy to snapshot server
if: ${{ inputs.deploy_snapshot }}
continue-on-error: true
shell: bash
run: |
# mv '${{ env.TAG_NAME }}-${{ env.DC_VER }}.7z' doublecmd-release/;
mv ${{ env.ZIP_RELEASE_ARCHIVE }} doublecmd-release/;
bash ./.github/scripts/upload_snapshot_pv_pre.sh;
- name: Deploy to snapshot server
if: ${{ inputs.deploy_snapshot }}
continue-on-error: true
shell: bash
run: bash ./.github/scripts/upload_snapshot_pv.sh
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
SSH_PRIVATE_KEY_P: ${{ secrets.SERVER_SSH_KEY_P }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
- name: Archive ALL
if: ${{ inputs.archive_all }}
continue-on-error: true
uses: deep-soft/zip-release@v2
with:
type: 'zip'
filename: 'sets.zip'
directory: '.'
path: '.'
exclusions: 'doublecmd.app'
- name: Upload artifact
if: ${{ inputs.archive_all }}
continue-on-error: true
uses: deep-soft/upload-artifact@v4
with:
name: sets.zip
path: sets.zip
- name: Print REVISION
continue-on-error: true
shell: bash
run: |
echo "Version: ${{ env.DC_VER }}";
echo "Revision: ${{ env.DC_REVISION }}";