117 lines
3 KiB
YAML
117 lines
3 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
|
|
|
|
docker:
|
|
name: Publish Docker :nightly
|
|
needs:
|
|
- call-build-workflow
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install
|
|
env:
|
|
SEIHON_VERSION: v0.9.0
|
|
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-nightly
|
|
|
|
|
|
apt:
|
|
name: Publish APT nightly
|
|
needs:
|
|
- call-build-workflow
|
|
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.17
|
|
id: go
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
|
|
- 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: --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: |
|
|
for filename in release/*.deb; do
|
|
echo "Pushing $filename to 'unstable'"
|
|
cloudsmith push deb evcc/unstable/any-distro/any-version $filename
|
|
done
|