Skip to content

Commit

Permalink
Merge pull request #20 from bellroy/ci-update-202211
Browse files Browse the repository at this point in the history
update all actions and nix
  • Loading branch information
cattruscott authored Nov 10, 2022
2 parents bf99046 + dbcccfe commit a2dadc3
Showing 1 changed file with 64 additions and 40 deletions.
104 changes: 64 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,70 @@ env:
on:
push:
branches-ignore:
- refs/tags/*_staging
- refs/tags/*_production
- refs/tags/*_staging
- refs/tags/*_production
jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: "${{ runner.OS }}-gem-cache-${{ hashFiles('**/*.gemspec')
}}"
restore-keys: "${{ runner.OS }}-gem-cache-\n"
- uses: "cachix/install-nix-action@8d6d5e949675fbadb765c6b1a975047fa5f09b27"
with:
extra_nix_config: |
post-build-hook = /etc/nix/upload-to-cache.sh
substituters = https://cache.nixos.org/
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
nix_path: nixpkgs=channel:nixos-21.05
- name: Run CI through nix-shell
env:
GEMFURY_DEPLOY_TOKEN: ${{ secrets.GEMFURY_DEPLOY_TOKEN }}
run: nix-shell --run "chmod 755 ./run_ci.sh && ./run_ci.sh"
- name: Post to Slack if build fails
if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
|| github.ref == 'refs/heads/stable')
uses: pullreminders/slack-action@a5a262c896a1cc80dcbae59ba95513e2dfb21439
env:
SLACK_BOT_TOKEN: "${{ secrets.BELLROY_SLACK_TOKEN }}"
with:
args: '{\"channel\":\"${{ env.SLACK_CHANNEL_ID }}\",\"text\":\"* ${{ github.repository }} BUILD
FAILURE*\", \"attachments\": [{ \"fallback\": \"Failure summary\", \"color\":
\"#ff0000\", \"fields\": [{\"title\": \"Branch\", \"value\":\"${{ steps.extract_branch.outputs.branch
}}\"}, {\"title\": \"Who broke it\", \"value\":\"${{ github.actor }}\"},
{ \"title\": \"Build output\", \"value\": \"https://github.com/${{ github.repository
}}/commit/${{ github.sha }}/checks\", \"short\": false }]}]}'
- name: Checkout branch
# Pin to v3.1.0 SHA
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Cache gems
# Pin to 3.0.11 SHA
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: vendor/bundle
key: "${{ runner.OS }}-gem-cache-${{ hashFiles('**/*.gemspec')
}}"
restore-keys: "${{ runner.OS }}-gem-cache-\n"
# Pin to the v18 SHA
- uses: "cachix/install-nix-action@daddc62a2e67d1decb56e028c9fa68344b9b7c2a"
with:
extra_nix_config: |
post-build-hook = /etc/nix/upload-to-cache.sh
substituters = https://cache.nixos.org/
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
nix_path: nixpkgs=channel:nixos-22.05
install_url: https://releases.nixos.org/nix/nix-2.7.0/install
- name: Run CI through nix-shell
env:
GEMFURY_DEPLOY_TOKEN: ${{ secrets.GEMFURY_DEPLOY_TOKEN }}
run: nix-shell --run "chmod 755 ./run_ci.sh && ./run_ci.sh"
- name: Post to Slack if build fails
if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stable')
# Pin to the v1.23.0 SHA
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844
env:
SLACK_BOT_TOKEN: "${{ secrets.BELLROY_SLACK_TOKEN }}"
with:
channel-id: "${{ env.SLACK_CHANNEL_ID }}"
payload: |
{
"text": "* ${{ github.repository }} BUILD FAILURE*",
"attachments": [
{
"fallback": "Failure summary",
"color": "ff0000",
"fields": [
{
"title": "Branch",
"value": "${{ steps.extract_branch.outputs.branch}}"
},
{
"title": "Who broke it",
"value": "${{ github.actor }}"
},
{
"title": "Build output",
"value": "https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks",
"short": false
}
]
}
]
}

0 comments on commit a2dadc3

Please sign in to comment.