This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
Packaging #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Packaging | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- dev-build | |
release: | |
jobs: | |
build: | |
name: "[${{ matrix.job.os }}] - ${{ matrix.job.target }}" | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, pkg-name: x86_64 } | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Install LLVM | |
uses: KyleMayes/install-llvm-action@v2 | |
with: | |
version: "15" | |
env: true | |
- name: Configure CMake | |
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release --toolchain=cmake/toolchains/${{ matrix.job.target }}.toolchain.cmake | |
- name: Build | |
run: cmake --build ${{ github.workspace }}/build --target filc | |
- name: Get metadata | |
id: metadata | |
run: | | |
BINARY_PATH=${{ github.workspace }}/build/filc | |
echo "BINARY_PATH=${BINARY_PATH}" >> $GITHUB_OUTPUT | |
PACKAGE_VERSION=$(cat VERSION) | |
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT | |
- name: Create Debian package | |
if: startsWith(matrix.job.os, 'ubuntu') | |
id: debian_package | |
run: | | |
DEB_PKG_NAME=filc-${{ steps.metadata.outputs.PACKAGE_VERSION }}.${{ matrix.job.pkg-name }}.deb | |
${{ github.workspace }}/bin/build_deb_package.sh ${{ steps.metadata.outputs.BINARY_PATH }} ${{ steps.metadata.outputs.PACKAGE_VERSION }} ${{ matrix.job.pkg-name }} | |
mv filc.deb $DEB_PKG_NAME | |
echo "DEB_PKG_NAME=${DEB_PKG_NAME}" >> $GITHUB_OUTPUT | |
- name: Create RPM package | |
if: startsWith(matrix.job.os, 'ubuntu') | |
id: rpm_package | |
run: | | |
${{ github.workspace }}/bin/build_rpm_package.sh ${{ steps.metadata.outputs.BINARY_PATH }} ${{ steps.metadata.outputs.PACKAGE_VERSION }} | |
RPM_PKG_PATH=$(find ~/rpmbuild/RPMS | grep "\.rpm") | |
RPM_PKG_NAME=$(basename $RPM_PKG_PATH) | |
echo "RPM_PKG_PATH=${RPM_PKG_PATH}" >> $GITHUB_OUTPUT | |
echo "RPM_PKG_NAME=${RPM_PKG_NAME}" >> $GITHUB_OUTPUT | |
- name: "Artifact upload: Debian package" | |
if: steps.debian_package.outputs.DEB_PKG_NAME | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.debian_package.outputs.DEB_PKG_NAME }} | |
path: ${{ github.workspace }}/${{ steps.debian_package.outputs.DEB_PKG_NAME }} | |
- name: "Artifact upload: RPM package" | |
if: steps.rpm_package.outputs.RPM_PKG_PATH | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.rpm_package.outputs.RPM_PKG_NAME }} | |
path: ${{ steps.rpm_package.outputs.RPM_PKG_PATH }} | |
- name: Upload to release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: JasonEtco/upload-to-release@master | |
with: | |
args: ${{ github.workspace }}/${{ steps.debian_package.outputs.DEB_PKG_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docker: | |
name: Build docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Log into ghcr.io | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u fil-language --password-stdin | |
- name: Build image | |
run: docker build -t ghcr.io/fil-language/filc:devel . | |
- name: Tag latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
docker image tag ghcr.io/fil-language/filc:devel ghcr.io/fil-language/filc:latest | |
docker image tag ghcr.io/fil-language/filc:devel ghcr.io/fil-language/filc:$(cat VERSION) | |
- name: Publish image | |
run: docker push ghcr.io/fil-language/filc:devel | |
- name: Publish latest image | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
docker push ghcr.io/fil-language/filc:latest | |
docker push ghcr.io/fil-language/filc:$(cat VERSION) |