mrtazz/checkmake

View on GitHub
.github/workflows/packages.yml

Summary

Maintainability
Test Coverage
name: release
on:
  push:
    tags:
      - '*'

jobs:
  packages:
    name: packagecloud
    runs-on: ubuntu-latest
    env:
      BUILDER_NAME: "GitHub Actions"
      BUILDER_EMAIL: noreply@actions.github.com

    steps:

    - name: Set up Go 1.13
      uses: actions/setup-go@v2
      with:
        go-version: 1.13
      id: go

    - name: Check out code
      uses: actions/checkout@v2
      with:
        fetch-depth: 1

    - name: install dependencies
      run: |
        sudo wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb
        sudo dpkg -i pandoc-2.7.3-1-amd64.deb
        rm -f pandoc-2.7.3-1-amd64.deb
        sudo gem install fpm package_cloud

    - name: build and run unit tests
      run: make clean all test

    - name: deploy packages
      run: make deploy-packages
      env:
        PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

  release:
    name: github
    runs-on: ubuntu-latest
    env:
      BUILDER_NAME: "GitHub Actions"
      BUILDER_EMAIL: noreply@actions.github.com

    steps:

    - name: Set up Go 1.17
      uses: actions/setup-go@v2
      with:
        go-version: 1.17
      id: go

    - name: Check out code
      uses: actions/checkout@v2
      with:
        fetch-depth: 1

    - name: install dependencies
      run: |
        sudo wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb
        sudo dpkg -i pandoc-2.7.3-1-amd64.deb

    - name: build for platforms
      run: |
        BUILD_GOARCH=amd64 BUILD_GOOS=freebsd make build-standalone
        BUILD_GOARCH=amd64 BUILD_GOOS=linux   make build-standalone
        BUILD_GOARCH=amd64 BUILD_GOOS=darwin  make build-standalone

    - name: create release
      run: make github-release
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  docker:
    name: docker
    env:
      BUILDER_NAME: "GitHub Actions"
      BUILDER_EMAIL: noreply@actions.github.com

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Build the Docker image
      run: docker build --build-arg BUILDER_NAME=CI --build-arg BUILDER_EMAIL=ci@test.only . --file Dockerfile --tag mrtazz/checkmake:${GITHUB_SHA} --tag mrtazz/checkmake:latest

    - name: push the docker image to docker hub
      if: github.ref == 'refs/heads/main'
      run: |
        echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u mrtazz --password-stdin
        docker push mrtazz/checkmake:${GITHUB_SHA}
        docker push mrtazz/checkmake:latest
        docker logout hub.docker.com