122 lines
3.1 KiB
YAML
122 lines
3.1 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@v3
|
|
- 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
|
|
|
|
docker:
|
|
name: Publish Docker :nightly
|
|
needs:
|
|
- call-build-workflow
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: refs/heads/master # force master
|
|
fetch-depth: 0
|
|
|
|
- name: Login
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASS }}
|
|
|
|
- name: Setup Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Publish
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v6
|
|
push: true
|
|
tags: |
|
|
andig/evcc:nightly
|
|
|
|
apt:
|
|
name: Publish APT nightly
|
|
needs:
|
|
- call-build-workflow
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ^1.18
|
|
cache: true
|
|
id: go
|
|
|
|
- name: Install Cloudsmith CLI
|
|
run: pip install --upgrade cloudsmith-cli
|
|
|
|
- name: Create nightly build
|
|
uses: goreleaser/goreleaser-action@v3
|
|
with:
|
|
version: latest
|
|
args: --snapshot -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: make apt-nightly
|
|
|
|
hassio:
|
|
name: Hassio Addon
|
|
needs:
|
|
- docker
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@master
|
|
with:
|
|
repository: evcc-io/hassio-addon
|
|
token: ${{ secrets.GH_TOKEN }}
|
|
path: ./hassio
|
|
|
|
- name: Update version
|
|
run: |
|
|
sed -i -e s#\"version.*#\"version\":\ \"nightly-$(date +'%Y%m%d%H%M%S')\",# ./hassio/evcc-nightly/config.json
|
|
|
|
- name: Push
|
|
run: |
|
|
cd ./hassio
|
|
git add .
|
|
git config user.name github-actions
|
|
git config user.email github-actions@github.com
|
|
git commit -am "config.json updated from Project evcc release"
|
|
git push
|