Skip to content

Sync release assets from template #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
470b35a
Use standardized filename for nightly build workflow
per1234 Aug 2, 2021
e974903
Add source URL comments to release assets
per1234 Aug 2, 2021
d131a9d
Add reference comments to project configuration files
per1234 Aug 2, 2021
31b2cce
Use standardized job/step names in release workflows
per1234 Aug 2, 2021
d1072a3
Fix minor typo in workflow comment
per1234 Aug 2, 2021
3733612
Remove fork filter conditional from Go nightly build workflow
per1234 Aug 2, 2021
55dec6d
Use latest version of `actions/checkout` action in release workflow
per1234 Aug 2, 2021
e00c1a9
Quote all paths in release workflows
per1234 Aug 2, 2021
7d48e7b
Use project-name agnostic environment variable in Go release workflows
per1234 Aug 2, 2021
0355dc1
Use workflow variables for project-specific data in release assets
per1234 Aug 3, 2021
9497e8f
Fail release workflows if artifact source files not found
per1234 Aug 3, 2021
83d06a3
Add manual trigger events to "Publish Nightly Build" workflow
per1234 Aug 3, 2021
4cc86e2
Break up long certificate import commands in release workflows
per1234 Aug 3, 2021
1031931
Report all failures of "Publish Nightly Build" workflow
per1234 Aug 3, 2021
ff18f3f
Remove obsolete mention of goreleaser from release workflows
per1234 Aug 3, 2021
8876b33
Remove superfluous checkout from "Publish Nightly Build" workflow job
per1234 Aug 3, 2021
7375f63
Make "Release" workflow's changelog generation regex support prereleases
per1234 Aug 3, 2021
b88c5e1
Add quoting to Bash command used to identify prereleases in "Release"…
per1234 Aug 3, 2021
e1bf10c
Use actively maintained release creation action in "Release" workflow
per1234 Aug 3, 2021
2f17bdc
Sanitize git log output used to provide versioning information to bui…
per1234 Aug 3, 2021
62537b9
Replace discouraged shell syntax in taskfile dynamic variable
per1234 Aug 3, 2021
d5acda4
Make version identification command used for build handle overlapping…
per1234 Aug 3, 2021
8647a96
Use styleguide-compliant key order in template taskfiles
per1234 Aug 3, 2021
2889722
Make templating compliant with the taskfile style guide
per1234 Aug 3, 2021
86692a2
Update Go version used for project to 1.16
per1234 Aug 3, 2021
e02295f
Run `go mod tidy` after updating to Go 1.16
per1234 Aug 3, 2021
e48a1b1
Make `go:lint` task compatible with Go 1.16
per1234 Aug 3, 2021
4b9f0d5
Use standardized build data variable names
per1234 Aug 3, 2021
4bf9bf4
Use `go install` to install code generation tools
per1234 Aug 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/check-go-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check Go

env:
# See: https://github.com/actions/setup-go/tree/v2#readme
GO_VERSION: "1.14"
GO_VERSION: "1.16"

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
Expand Down Expand Up @@ -88,6 +88,9 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install golint
run: go install golang.org/x/lint/golint@latest

- name: Check style
run: task --silent go:lint

Expand Down
134 changes: 0 additions & 134 deletions .github/workflows/nightly.yml

This file was deleted.

156 changes: 156 additions & 0 deletions .github/workflows/publish-go-nightly-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/publish-go-nightly-task.md
name: Publish Nightly Build

env:
# As defined by the Taskfile's PROJECT_NAME variable
PROJECT_NAME: arduino-lint
# As defined by the Taskfile's DIST_DIR variable
DIST_DIR: dist
# The project's folder on Arduino's download server for uploading builds
AWS_PLUGIN_TARGET: /arduino-lint/
ARTIFACT_NAME: dist

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
schedule:
# run every day at 1AM
- cron: "0 1 * * *"
workflow_dispatch:
repository_dispatch:

jobs:
create-nightly-artifacts:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Taskfile
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Build
env:
NIGHTLY: true
run: task dist:all

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.DIST_DIR }}

notarize-macos:
runs-on: macos-latest
needs: create-nightly-artifacts

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.DIST_DIR }}

- name: Import Code-Signing Certificates
env:
KEYCHAIN: "sign.keychain"
INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12"
KEYCHAIN_PASSWORD: keychainpassword # Arbitrary password for a keychain that exists only for the duration of the job, so not secret
run: |
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}"
security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
security default-keychain -s "${{ env.KEYCHAIN }}"
security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
security import \
"${{ env.INSTALLER_CERT_MAC_PATH }}" \
-k "${{ env.KEYCHAIN }}" \
-f pkcs12 \
-A \
-T /usr/bin/codesign \
-P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}"
security set-key-partition-list \
-S apple-tool:,apple: \
-s \
-k "${{ env.KEYCHAIN_PASSWORD }}" \
"${{ env.KEYCHAIN }}"

- name: Install gon for code signing and app notarization
run: |
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip
unzip gon_macos.zip -d /usr/local/bin

- name: Sign and notarize binary
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
run: |
gon gon.config.hcl

- name: Re-package binary and update checksum
# This step performs the following:
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
# 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file
run: |
# GitHub's upload/download-artifact@v2 actions don't preserve file permissions,
# so we need to add execution permission back until the action is made to do this.
chmod +x "${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_amd64/${{ env.PROJECT_NAME }}"
PACKAGE_FILENAME="$(basename ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_nightly-*_macOS_64bit.tar.gz)"
tar -czvf "${{ env.DIST_DIR }}/$PACKAGE_FILENAME" \
-C "${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_amd64/" "${{ env.PROJECT_NAME }}" \
-C ../../ LICENSE.txt
CHECKSUM="$(shasum -a 256 ${{ env.DIST_DIR }}/$PACKAGE_FILENAME | cut -d " " -f 1)"
perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CHECKSUM} ${PACKAGE_FILENAME}/g;" ${{ env.DIST_DIR }}/*-checksums.txt

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.DIST_DIR }}

publish-nightly:
runs-on: ubuntu-latest
needs: notarize-macos

steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.DIST_DIR }}

- name: Upload release files on Arduino downloads servers
uses: docker://plugins/s3
env:
PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*"
PLUGIN_TARGET: "${{ env.AWS_PLUGIN_TARGET }}nightly"
PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/"
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

report:
runs-on: ubuntu-latest
needs: publish-nightly
if: failure() # Run if publish-nightly or any of its job dependencies failed

steps:
- name: Report failure
uses: masci/datadog@v1
with:
api-key: ${{ secrets.DD_API_KEY }}
events: |
- title: "${{ env.PROJECT_NAME }} nightly build failed"
text: "Nightly build workflow has failed"
alert_type: "error"
host: ${{ github.repository }}
tags:
- "project:${{ env.PROJECT_NAME }}"
- "workflow:${{ github.workflow }}"
Loading