move docker workflow into build. Fix release workflow

This commit is contained in:
Jared Weakly 2020-06-17 13:26:44 -07:00
parent 0076943a45
commit 15e26ae9ee
3 changed files with 37 additions and 84 deletions

View File

@ -1,7 +1,8 @@
name: Cryptol
on:
push:
branches: [master]
branches: [master, "actions/**"]
tags: ["v**"]
pull_request:
jobs:
@ -10,6 +11,7 @@ jobs:
outputs:
changed: ${{ steps.outputs.outputs.changed-files }}
cryptol-version: ${{ steps.outputs.outputs.cryptol-version }}
name: ${{ steps.outputs.outputs.name }}
steps:
- uses: actions/checkout@v2
with:
@ -18,6 +20,7 @@ jobs:
run: |
.github/ci.sh set_files ${{ github.sha }}
.github/ci.sh set_version
.github/ci.sh output name cryptol-$(.github/ci.sh ver)
build:
runs-on: ${{ matrix.os }}
@ -74,7 +77,9 @@ jobs:
- shell: bash
run: .github/ci.sh test_dist
- if: "startsWith(github.ref, 'refs/tags/v') && matrix.ghc == '8.10.1'"
- if: >-
(startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/actions/'))
&& matrix.ghc == '8.10.1'
uses: actions/upload-artifact@v2
with:
path: dist/bin
@ -83,7 +88,9 @@ jobs:
docs:
runs-on: ubuntu-latest
needs: [outputs]
if: "startsWith(github.ref, 'refs/tags/v') || contains(needs.outputs.outputs.changed, 'docs/')"
if: >-
(startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/actions/'))
|| contains(needs.outputs.outputs.changed, 'docs/')
steps:
- uses: actions/checkout@v2
- uses: docker://pandoc/latex:latest
@ -103,14 +110,14 @@ jobs:
bundle:
runs-on: ${{ matrix.os }}
if: startsWith(github.ref, 'refs/tags/v')
if: "startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/actions/')"
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ghc: ["8.10.1"]
needs: [outputs, docs, build]
env:
VERSION: ${{ needs.outputs.outputs.cryptol-version }}
NAME: ${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64
steps:
- uses: actions/checkout@v2
@ -145,78 +152,37 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: cryptol-${{ env.VERSION }}-${{ runner.os }}-x86_64
path: "cryptol-${{ env.VERSION }}-${{ runner.os }}-x86_64.tar.gz*"
name: ${{ env.NAME }}
path: "${{ env.NAME }}.tar.gz*"
- uses: actions/upload-artifact@v2
if: runner.os == 'Windows'
with:
name: cryptol-${{ env.VERSION }}-${{ runner.os }}-x86_64.msi
name: ${{ env.NAME }}.msi
path: "cryptol.msi*"
release:
if: "github.event_name == 'push' && github.ref == 'refs/heads/master'"
if: "startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/actions/')"
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
runs-on: ubuntu-latest
steps:
- id: release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload-artifacts-to-release:
if: "github.event_name == 'push' && github.ref == 'refs/heads/master'"
strategy:
matrix:
os: [Linux, Windows, macOS]
if: "startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/actions/')"
needs: [outputs, bundle, release]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64
- if: runner.os == 'Windows'
uses: actions/download-artifact@v2
with:
name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi
- uses: actions/upload-release-asset@v1
path: artifacts
- run: ls -alR
- run: |
assets=()
for a in ./artifacts/*; do assets+=("-a" "$a"); done
tag="${GITHUB_REF##*/}"
hub release edit -d "${assets[@]}" -m "" "$tag"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.tar.gz
asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.tar.gz
asset_content_type: application/tar+gzip
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.tar.gz.sig
asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.tar.gz.sig
asset_content_type: application/pgp-signature
- if: runner.os == 'Windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi
asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi
asset_content_type: application/x-msi
- if: runner.os == 'Windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi.sig
asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi.sig
asset_content_type: application/pgp-signature

View File

@ -1,24 +0,0 @@
name: Cryptol Dockerfile
on:
push:
branches:
- "actions/*"
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
name: Cryptol Docker
steps:
- uses: actions/checkout@v2
- id: outputs
run: .github/ci.sh output version cryptol-$(.github/ci.sh ver)-$(date -I)
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: galoisinc/cryptol
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ steps.outputs.outputs.version }}"

View File

@ -1,8 +1,7 @@
name: Cryptol Nightly Builds
on:
push:
branches:
- "actions/*"
branches: ["actions/**"]
schedule:
- cron: "0 0 * * *"
@ -38,6 +37,18 @@ jobs:
path: docs
name: docs
docker:
runs-on: ubuntu-latest
needs: [outputs]
steps:
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: galoisinc/cryptol
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ needs.outputs.outputs.cryptol-version }}"
build:
needs: [outputs, docs]
runs-on: ${{ matrix.os }}