diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3cdb1e3c..93ae2ba2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/setup-go@v1 with: - go-version: 1.13 + go-version: 1.16 - uses: actions/checkout@v2 - name: Setup Code Climate test-reporter run: | @@ -46,31 +46,33 @@ jobs: runs-on: ubuntu-latest needs: test steps: - - + - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - - - name: Set up Go + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: '1.16' + - + name: Cache Go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Docker Login - if: startsWith(github.ref, 'refs/tags/v') env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - - - name: Login to GitHub Container Registry - if: startsWith(github.ref, 'refs/tags/v') - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bc2b2358..8af841d2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,10 +2,10 @@ name: "CodeQL" on: push: - branches: [main] + branches: [master] pull_request: # The branches below must be a subset of the branches above - branches: [main] + branches: [master] schedule: - cron: '0 4 * * 5' diff --git a/.github/workflows/publish_website.yaml b/.github/workflows/publish_website.yaml new file mode 100644 index 00000000..e7ebca0e --- /dev/null +++ b/.github/workflows/publish_website.yaml @@ -0,0 +1,37 @@ +name: Publish signatory.io website +on: + push: + branches: + - master + +jobs: + publish-docs: + runs-on: ubuntu-latest + defaults: + run: + working-directory: website + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: install npm deps + run: npm ci + - name: Publish to Github pages + env: + GITHUB_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }} + GITHUB_EMAIL: ${{ secrets.DEPLOY_GITHUB_EMAIL }} + GIT_USER: ${{ secrets.DEPLOY_GITHUB_USER }} + CURRENT_BRANCH: $GITHUB_REF + run: | + git config --global user.email "$GITHUB_EMAIL" + git config --global user.name "$GITHUB_ACTOR" + echo "machine github.com login $GIT_USER password $GITHUB_TOKEN" > ~/.netrc + cat ~/.netrc + GIT_USER=${GIT_USER} npm run deploy diff --git a/.goreleaser.yml b/.goreleaser.yml index 5c226428..87e9a02a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,6 @@ before: hooks: + - go mod download builds: - id: signatory binary: signatory @@ -10,13 +11,18 @@ builds: - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' goos: + - freebsd - linux - windows - darwin goarch: - amd64 - arm - - arm64 + ignore: + - goos: darwin + goarch: 386 + - goos: windows + goarch: 386 - id: signatory-cli binary: signatory-cli env: @@ -26,50 +32,32 @@ builds: - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' goos: + - freebsd - linux - windows - darwin goarch: - amd64 - arm - - arm64 + ignore: + - goos: darwin + goarch: 386 + - goos: windows + goarch: 386 dockers: - - ids: + - binaries: - signatory - signatory-cli - - image_templates: - - 'ecadlabs/signatory:{{ .Tag }}-amd64' - - 'ecadlabs/signatory:latest-amd64' - - 'ghcr.io/ecadlabs/signatory:{{ .Tag }}-amd64' - - 'ghcr.io/ecadlabs/signatory:latest-amd64' - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - "--pull" - - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.name={{.ProjectName}}" - - "--label=org.opencontainers.image.revision={{.FullCommit}}" - - "--label=org.opencontainers.image.version={{.Version}}" - - "--label=org.opencontainers.image.source={{.GitURL}}" - - "--platform=linux/amd64" - - image_templates: - - 'ecadlabs/signatory:{{ .Tag }}-arm64' - - 'ecadlabs/signatory:latest-arm64' - - 'ghcr.io/ecadlabs/signatory:{{ .Tag }}-arm64' - - 'ghcr.io/ecadlabs/signatory:latest-arm64' + builds: + - signatory + - signatory-cli + image_templates: + - 'ecadlabs/signatory:latest' + - 'ecadlabs/signatory:{{ .Tag }}' dockerfile: Dockerfile - use: buildx - build_flag_templates: - - "--pull" - - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.name={{.ProjectName}}" - - "--label=org.opencontainers.image.revision={{.FullCommit}}" - - "--label=org.opencontainers.image.version={{.Version}}" - - "--label=org.opencontainers.image.source={{.GitURL}}" - - "--platform=linux/arm64" - goarch: arm64 archives: - replacements: + '386': i386 darwin: Darwin linux: Linux windows: Windows @@ -83,5 +71,4 @@ changelog: filters: exclude: - '^docs:' - - '^website:' - '^test:' diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 6f698a73..16b167a8 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -85,7 +85,7 @@ module.exports = { path: '../docs', sidebarPath: require.resolve('./sidebars.js'), editUrl: - 'https://github.com/ecadlabs/signatory/edit/main/website/', + 'https://github.com/ecadlabs/signatory/edit/master/website/', }, theme: { customCss: require.resolve('./src/css/custom.css'),