nightly #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v2 | |
- name: Check for changes | |
id: check_changes | |
run: | | |
git fetch --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
if [ "$(git log --since=yesterday --pretty=oneline)" = "" ]; then | |
echo "::set-output name=skip::true" | |
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: 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 "DATE=$(date +'%Y%m%d')" >> "$GITHUB_ENV" | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: odoo-lsp-*/odoo-lsp-* | |
name: nightly-${{ env.DATE }} | |
generate_release_notes: true | |