evcc-io/.github/workflows/nightly.yml
Andreas Linde 54a4fe72ef
Add deb package and nightly distribution (#1977)
- Add publishing automated debian package releases via Cloudsmith.io, which allows evcc to be installed and updated via `apt`
- Add nightly docker (:latest) and deb distribution
- Disable docker builds for every commit on master
- Allow nightly builds to be triggered manually
2021-12-04 13:05:18 +01:00

113 lines
No EOL
2.9 KiB
YAML

name: Nightly Build
on:
schedule: # runs on the default branch: master
- cron: '0 2 * * *' # run at 2 AM UTC
workflow_dispatch:
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
call-build-workflow:
name: Call Build
needs: check_date
if: |
${{ needs.check_date.outputs.should_run != 'false' }}
&& startsWith(github.ref, 'refs/heads/master')
&& ! contains(github.head_ref, 'refs/heads/chore/')
uses: evcc-io/evcc/.github/workflows/default.yml@master
dockerlatest:
name: Publish Docker :latest
needs:
- build
- build-ui
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install
env:
SEIHON_VERSION: v0.8.4
run: curl -sfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | sudo bash -s -- -b $GOPATH/bin ${SEIHON_VERSION}
- name: Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Publish
run: make publish-latest-ci
nightly:
name: Publish APT nightly
needs:
- build
- build-ui
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache Go modules
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.16
id: go
- name: Install Cloudsmith CLI
run: pip install --upgrade cloudsmith-cli
- name: Clean git
run: |
git checkout go.*
rm -rf flags buildflags
- name: Create nightly build
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release -f .goreleaser-nightly.yml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish .deb to Cloudsmith
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: |
for filename in dist/*.deb; do
echo "Pushing $filename to 'unstable'"
cloudsmith push deb evcc/unstable/any-distro/any-version $filename
done