Skip to content

ci

ci #38

Workflow file for this run

name: ci
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
schedule:
- cron: '0 0 * * 3'
workflow_dispatch: # manual trigger
env:
APPIMAGE_BUILDER_URL: 'https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.0.3/appimage-builder-1.0.3-x86_64.AppImage'
BUILD_DIR: /tmp/build
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
source: [release, continuous]
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install build dependencies
run: |
sudo apt update
sudo apt install automake autoconf libx11-dev zlib1g-dev \
libxml2-dev libxslt1-dev libxft-dev zip
- name: Download appimage-builder
run: |
mkdir -p $BUILD_DIR && cd $BUILD_DIR
wget $APPIMAGE_BUILDER_URL -O appimage-builder
chmod +x appimage-builder
- name: Download latest release
run: |
cd $BUILD_DIR
wget $(curl -s $URL | jq -r .tarball_url) -O ds9.tar.gz
mkdir -p ds9
tar -zxf ds9.tar.gz -C ds9 --strip-components=1
echo "VERSION=$(echo $(curl -s $URL | jq -r .tag_name) | sed 's/v//')" | tee -a $GITHUB_ENV
echo "UPDATE_INFO=gh-releases-zsync|epassaro|ds9-appimage|latest|SAOImageDS9-*x86_64.AppImage.zsync" | tee -a $GITHUB_ENV
env:
URL: 'https://api.github.com/repos/SAOImageDS9/SAOImageDS9/releases/latest'
if: ${{ matrix.source == 'release' }}
- name: Download master branch
run: |
cd $BUILD_DIR
wget $URL -O ds9.tar.gz
mkdir -p ds9
tar -zxf ds9.tar.gz -C ds9 --strip-components=1
echo "VERSION=continuous" | tee -a $GITHUB_ENV
echo "UPDATE_INFO=gh-releases-zsync|epassaro|ds9-appimage|continuous|SAOImageDS9-*x86_64.AppImage.zsync" | tee -a $GITHUB_ENV
env:
URL: 'https://github.com/SAOImageDS9/SAOImageDS9/archive/refs/heads/master.tar.gz'
if: ${{ matrix.source == 'continuous' }}
- name: Build program
run: |
cd $BUILD_DIR/ds9
./unix/configure
make
- name: Update YAML
run: |
cp AppImageBuilder.yml $BUILD_DIR
cd $BUILD_DIR
yq -i '.AppDir.app_info.version = strenv(VERSION)' AppImageBuilder.yml
yq -i '.AppImage.update-information = strenv(UPDATE_INFO)' AppImageBuilder.yml
cat AppImageBuilder.yml
- name: Create AppImage
run: |
cp ds9.png $BUILD_DIR
cd $BUILD_DIR
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/icons/hicolor/128x128/apps
#cp ds9/bin/* AppDir/usr/bin
cp ds9/bin/ds9 AppDir/usr/bin
cp ds9.png AppDir/usr/share/icons/hicolor/128x128/apps
./appimage-builder --recipe AppImageBuilder.yml
- name: List files
run: ls -R $BUILD_DIR
- name: Upload new release
uses: ncipollo/release-action@v1
with:
tag: v${{ env.VERSION }}
allowUpdates: true
artifacts: '${{ env.BUILD_DIR }}/SAOImageDS9-*'
artifactErrorsFailBuild: true
body: |
This AppImage has been created through a continuous delivery pipeline.
See the [code release](https://github.com/SAOImageDS9/SAOImageDS9/releases/tag/v${{ env.VERSION }}) for a list of fixes and features.
if: ${{ matrix.source == 'release' }}
- name: Update continuous build
uses: ncipollo/release-action@v1
with:
name: 'Continuous build'
tag: ${{ env.VERSION }}
prerelease: true
allowUpdates: true
artifacts: '${{ env.BUILD_DIR }}/SAOImageDS9-*'
artifactErrorsFailBuild: true
body: |
This AppImage has been created and released through a continuous delivery pipeline.
Pre-release is up-to-date with the [source code](https://github.com/SAOImageDS9/SAOImageDS9) master branch.
if: ${{ matrix.source == 'continuous' }}