Skip to content

nightly

nightly #14

Workflow file for this run

name: nightly
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * *"
env:
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash
jobs:
check:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_changes.outputs.skip }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for changes
id: check_changes
run: |
if [ "$(git log $(git describe --tags --abbrev=0)..HEAD --oneline)" = "" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
build:
needs: check
runs-on: ${{ matrix.os }}
if: needs.check.outputs.skip != 'true'
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
- name: Build
run: cargo build --release
- name: Get short SHA
id: sha
# run: echo "::set-output name=sha::$(echo '{{ github.sha }}' | cut -c1-8)"
run: echo "SHA=$(echo '${{ github.sha }}' | cut -c1-8)" >> "$GITHUB_ENV"
- name: Zip files
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv ./target/release/odoo-lsp.exe .
7z a -tzip odoo-lsp-${{ env.SHA }}-${{ matrix.os }}.zip ./odoo-lsp.exe
else
mv ./target/release/odoo-lsp .
tar -czvf odoo-lsp-${{ env.SHA }}-${{ matrix.os }}.tar.gz ./odoo-lsp
fi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./odoo-lsp-${{ env.SHA }}-${{ matrix.os }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }}
name: odoo-lsp-${{ env.SHA }}-${{ matrix.os }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Generate checksums
run: |
for file in odoo-lsp-*/odoo-lsp-*; do
openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256";
done
- name: Get current date
id: date
run: echo "TAG=nightly-$(date +'%Y%m%d')" >> "$GITHUB_ENV"
- name: Create tag
run: git tag -f ${{ env.TAG }} && git push --tags
- name: Release
uses: softprops/action-gh-release@v1
with:
files: odoo-lsp-*/odoo-lsp-*
name: ${{ env.TAG }}
tag_name: ${{ env.TAG }}
generate_release_notes: true
prerelease: true