Sync channels #975
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: Sync channels | |
on: | |
schedule: | |
# The nightly channel is usually updated at 01:00:00 UTC. | |
- cron: '0 2 * * *' # *-*-* 02:00:00 UTC | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
sync-channels: | |
name: Sync channels and prefetch toolchains | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
ref: master | |
- name: Install Nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=channel:nixpkgs-unstable | |
# Workaround for https://github.com/oxalica/rust-overlay/issues/54 | |
- name: Don't let ~/.cargo/bin mess things up | |
run: rm -rf ~/.cargo/bin | |
- name: Sync stable channel | |
timeout-minutes: 5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./scripts/fetch.py stable | |
- name: Sync beta channel | |
timeout-minutes: 5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./scripts/fetch.py beta | |
- name: Sync nightly channel | |
timeout-minutes: 5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./scripts/fetch.py nightly | |
- name: Check and commit changes | |
id: commit | |
continue-on-error: true | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add manifests | |
git commit -m "manifest: update" | |
- name: Validate nix files changed | |
if: steps.commit.outcome == 'success' | |
run: | | |
files=( $(git diff --name-only HEAD HEAD^ '*.nix') ) | |
echo "${#files[*]} nix files changed: ${files[*]}" | |
if [[ "${#files[*]}" -ne 0 ]]; then | |
nix-instantiate --parse "${files[@]}" >/dev/null | |
fi | |
- name: Test stable Rust | |
if: steps.commit.outcome == 'success' | |
run: | | |
cd examples/hello-world | |
set -o pipefail | |
nix-shell --pure --command "make run" | tee out | |
[[ "$(< out)" == *"Hello, world!"* ]] | |
- name: Push changes | |
if: steps.commit.outcome == 'success' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: master |