Skip to content

Publish releases

Publish releases #2079

Workflow file for this run

name: Publish releases
on:
# Triggers the workflow on push when pushing to a version tag
push:
tags:
- '*lantern-*'
workflow_run:
workflows: [ "go" ]
types:
- completed
workflow_dispatch:
permissions:
contents: "read"
id-token: "write"
env:
GOPRIVATE: github.com/getlantern
S3_BUCKET: lantern
jobs:
determine-platform:
runs-on: ubuntu-latest
outputs:
platform: ${{ steps.set-platform.outputs.platform }}
steps:
- name: Determine Platform
id: set-platform
run: |
echo "GITHUB_REF is: $GITHUB_REF"
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo "Tag is: $TAG"
if [[ $TAG == ios-* ]]; then
echo "Platform determined: ios"
echo "platform=ios" >> "$GITHUB_OUTPUT"
elif [[ $TAG == android-* ]]; then
echo "Platform determined: android"
echo "platform=android" >> "$GITHUB_OUTPUT"
elif [[ $TAG == desktop-* ]]; then
echo "Platform determined: macos"
echo "platform=desktop" >> "$GITHUB_OUTPUT"
else
echo "Platform determined: all (tag did not match specific platforms)"
echo "platform=all" >> "$GITHUB_OUTPUT"
fi
else
echo "Not a tag reference, defaulting to all platforms"
echo "platform=all" >> "$GITHUB_OUTPUT"
fi
set-version:
needs: determine-platform
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
prefix: ${{ steps.set-version.outputs.prefix }}
version_file: ${{ steps.set-version.outputs.version_file }}
steps:
- id: set-version
shell: python
run: |
import sys, os
ref = os.environ.get("GITHUB_REF","")
if "refs/tags/lantern" not in ref:
li = 'lantern-installer-dev'
vf = 'version-android-dev.txt'
version = '9999.99.99-dev'
else:
a = ref.strip().replace('refs/tags/lantern-', '')
parts = a.split('-',1)
suffix = parts[1] if len(parts)>1 else ''
beta = 'beta' in suffix
internal = 'internal' in suffix
if beta:
li = 'lantern-installer-preview'
vf = 'version-android-beta.txt'
version = parts[0]
elif internal:
li = 'lantern-installer-internal'
vf = 'version-android-internal.txt'
version = parts[0]
else:
li = 'lantern-installer'
vf = 'version-android.txt'
version = a
print('Setting version to ' + version)
print('Setting prefix to ' + li)
print('Setting version file to ' + vf)
print(f'::set-output name=version::{version}')
print(f'::set-output name=prefix::{li}')
print(f'::set-output name=version_file::{vf}')
# build-windows-x32:
# uses: ./.github/workflows/build-windows.yml
# secrets: inherit
# needs: set-version
# with:
# version: ${{ needs.set-version.outputs.version }}
# prefix: ${{ needs.set-version.outputs.prefix }}
# dist-suffix: 32-bit
# installer-suffix: -x32
# update-suffix: 386
# arch: x32
build-windows-x64:
uses: ./.github/workflows/build-windows.yml
secrets: inherit
needs: set-version
with:
version: ${{ needs.set-version.outputs.version }}
prefix: ${{ needs.set-version.outputs.prefix }}
build-suffix: 64
dist-suffix: 64-bit
update-suffix: x64
installer-suffix: -x64
arch: x64
push-binaries:
runs-on: ubuntu-latest
needs: [ set-version, build-windows-x64 ]
env:
version: ${{ needs.set-version.outputs.version }}
prefix: ${{ needs.set-version.outputs.prefix }}
steps:
- name: Download the windows64 build output
uses: actions/download-artifact@v4
with:
name: windows64-installer-signed
- name: Download the windows msix
uses: actions/download-artifact@v4
with:
name: windows${{inputs.build-suffix}}-installer-msix
- name: Grant private modules access
run: git config --global url."https://${{ secrets.CI_PRIVATE_REPOS_GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/"
- name: Clone binaries repo
run: git clone --depth 1 https://github.com/getlantern/lantern-binaries
- name: Rename builds
run: |
diff lantern-installer-x64.exe ${{ env.prefix }}-64-bit.exe || mv -f lantern-installer-x64.exe ${{ env.prefix }}-64-bit.exe
diff lantern-installer-x64.msix ${{ env.prefix }}-64-bit.msix || mv -f lantern-installer-x64.msix ${{ env.prefix }}-64-bit.msix
- name: Prepare sha256 sums
run: |
shasum -a 256 ${{ env.prefix }}-x64.exe | cut -d " " -f 1 > ${{ env.prefix }}-x64.exe.sha256
- name: Commit
run: |
mv lantern-installer* ./lantern-binaries/
cd lantern-binaries
git config user.email "[email protected]"
git config user.name "Lantern Bot"
git add .
git commit -m "Lantern binaries for version ${{ env.version }}"
git push origin main