Attach macOS and Linux binaries to release

This commit is contained in:
sebthom
2022-01-30 09:25:32 +01:00
parent 1e1cffeab7
commit ea04b85007
6 changed files with 117 additions and 57 deletions

View File

@@ -12,6 +12,7 @@ on:
- '**'
paths-ignore:
- '**/*.md'
- '.github/*.yml'
pull_request:
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
@@ -21,7 +22,10 @@ defaults:
shell: bash
jobs:
###########################################################
build:
###########################################################
strategy:
fail-fast: false
matrix:
@@ -29,8 +33,11 @@ jobs:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Git Checkout
uses: actions/checkout@v2 #https://github.com/actions/checkout
@@ -83,15 +90,6 @@ jobs:
pdm run app version
pdm run app verify
- name: "Build docker image"
if: startsWith(matrix.os, 'linux')
run: |
set -eux
bash docker/build-image.sh
docker run --rm kleinanzeigen-bot/kleinanzeigen-bot help
- name: "Install: binutils (strip)"
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get --no-install-recommends install -y binutils
@@ -123,7 +121,6 @@ jobs:
;;
esac
- name: pyinstaller
run: |
set -eux
@@ -132,17 +129,48 @@ jobs:
ls -l dist
- name: run kleinanzeigen_bot.exe
if: startsWith(matrix.os, 'windows')
- name: run self-contained executable
run: |
set -eux
dist/kleinanzeigen-bot.exe help
dist/kleinanzeigen-bot.exe version
dist/kleinanzeigen-bot.exe verify
dist/kleinanzeigen-bot help
dist/kleinanzeigen-bot version
dist/kleinanzeigen-bot verify
- name: "Share: self-contained executable"
uses: actions/upload-artifact@v2
with:
name: artifacts-${{ matrix.os }}
path: dist/kleinanzeigen-bot*
- name: "Build docker image"
if: startsWith(matrix.os, 'ubuntu')
run: |
set -eux
bash docker/build-image.sh
docker run --rm kleinanzeigen-bot/kleinanzeigen-bot help
###########################################################
publish-release:
###########################################################
runs-on: ubuntu-latest
needs:
- build
if: github.ref == 'refs/heads/main'
concurrency: publish-latest-release # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency
steps:
- name: "SCM Checkout"
# only required by "hub release create" to prevent "fatal: Not a git repository"
uses: actions/checkout@v2 #https://github.com/actions/checkout
- name: "Get: all build artifacts"
uses: actions/download-artifact@v2
- name: "Delete previous 'latest' release"
if: startsWith(matrix.os, 'windows') && github.ref == 'refs/heads/main'
run: |
set -eu
@@ -163,17 +191,22 @@ jobs:
fi
- name: "Create 'latest' Release"
if: startsWith(matrix.os, 'windows') && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eux
mv artifacts-macos-latest/kleinanzeigen-bot kleinanzeigen-bot-darwin-amd64
mv artifacts-ubuntu-latest/kleinanzeigen-bot kleinanzeigen-bot-linux-amd64
mv artifacts-windows-latest/kleinanzeigen-bot.exe kleinanzeigen-bot-windows-amd64.exe
# https://hub.github.com/hub-release.1.html
hub release create "latest" \
--prerelease \
--message "latest" \
--attach "dist/kleinanzeigen-bot.exe#kleinanzeigen-bot.exe"
--attach "kleinanzeigen-bot-darwin-amd64" \
--attach "kleinanzeigen-bot-linux-amd64" \
--attach "kleinanzeigen-bot-windows-amd64.exe"
- name: "Delete intermediate build artifacts"
uses: geekyeggo/delete-artifact@1-glob-support # https://github.com/GeekyEggo/delete-artifact/