Skip to content

Commit

Permalink
ci(github): ♻️ github actions refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jan 27, 2024
1 parent f577359 commit 61484ae
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [ $default-branch, $protected-branches ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [ $default-branch, $protected-branches ]
schedule:
- cron: '11 0 * * 5'
workflow_dispatch:
Expand All @@ -16,7 +15,6 @@ jobs:
security-events: write
actions: read
contents: read

runs-on: ubuntu-latest

strategy:
Expand All @@ -27,6 +25,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install/Cache dependencies
id: cache_pkg_deps
Expand All @@ -38,7 +38,7 @@ jobs:
id: setup_go
uses: actions/setup-go@v5
with:
go-version: '^1.21.5'
go-version: '^1.21'

- name: Install Go dependencies
id: install_go_deps
Expand All @@ -48,24 +48,10 @@ jobs:
go install golang.org/x/text/cmd/gotext@latest
go install github.com/matryer/moq@latest
- name: Update VERSION
id: update_version
shell: sh
run: cd internal/agent/config && printf %s $(git tag | tail -1) > VERSION

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v3

- name: Build agent
run: |
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/release-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
release:
types: [ created ]
push:
branches:
- main
branches: [ $default-branch ]
tags: [ 'v*.*.*' ]

permissions:
contents: read
Expand All @@ -31,14 +31,31 @@ jobs:
with:
packages: qemu-user-static

- name: Docker Metadata
id: docker_metadata
uses: docker/metadata-action@v4
with:
images: |
${{ env.IMAGE }}
tags: |
type=edge
type=sha
type=ref,event=branch
type=ref,event=pr
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Build container image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
archs: amd64
# context: build/package
image: ${{ env.IMAGE }}
tags: latest ${{ github.sha }}
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
containerfiles: Dockerfile
layers: false
oci: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: release-please

on:
push:
branches:
- main
branches: [ $default-branch ]

permissions:
contents: write
Expand Down Expand Up @@ -38,7 +37,7 @@ jobs:
id: setup_go
uses: actions/setup-go@v5
with:
go-version: '^1.21.5'
go-version: '^1.21'

- name: Install Go dependencies
if: ${{ steps.release_please.outputs.release_created }}
Expand All @@ -50,6 +49,7 @@ jobs:
go install github.com/matryer/moq@latest
- name: install cosign
if: ${{ steps.release_please.outputs.release_created }}
id: install_cosign
uses: sigstore/[email protected]
with:
Expand Down

0 comments on commit 61484ae

Please sign in to comment.